Compare commits

...

1 Commits

Author SHA1 Message Date
zhoulongwang e0d4dedbdd src2
1 year ago

25
.gitignore vendored

@ -0,0 +1,25 @@
target/
!.mvn/wrapper/maven-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/

225
mvnw vendored

@ -0,0 +1,225 @@
#!/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.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Migwn, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
# TODO classpath?
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
echo $MAVEN_PROJECTBASEDIR
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

143
mvnw.cmd vendored

@ -0,0 +1,143 @@
@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 Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%

@ -0,0 +1,161 @@
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>crm</groupId>
<artifactId>crm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>crm</name>
<description>Final project</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-java8time</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
</dependency>
<dependency>
<groupId>io.github.jpenren</groupId>
<artifactId>thymeleaf-spring-data-dialect</artifactId>
<version>2.1.1</version>
</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>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator-docs</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sourceforge.nekohtml/nekohtml -->
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.21</version><!--$NO-MVN-MAN-VER$-->
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.8</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.59</version>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.15</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.15</version>
</dependency>
<dependency>
<groupId>net.sf.supercsv</groupId>
<artifactId>super-csv</artifactId>
<version>2.4.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,10 @@
spring.jpa.hibernate.ddl-auto=create-drop
spring.datasource.url=jdbc:mysql://localhost:3306/crm?useSSL=false
spring.datasource.username=root
spring.datasource.password=password
management.security.enabled=false
management.context-path=/appinfo
spring.thymeleaf.mode=LEGACYHTML5
spring.thymeleaf.cache=false

@ -0,0 +1,27 @@
insert into role (role_id, role) values (1, 'ROLE_ADMIN'), (2, 'ROLE_USER'), (3, 'ROLE_MANAGER'), (4, 'ROLE_OWNER');
INSERT INTO users (id, email, enabled, first_name, last_name, password, username, role_role_id)
VALUES ('1', 'a@u', '1', 'AFN', 'ALN', '$2a$10$iPgnenFIoM67cYL9let/iOLBphbDaEkAz3BmiXOCmWq5A4M2TkXAG', 'admin', '1'),
('2', 'u@m', '1', 'UFN', 'ULN', '$2a$10$Ad.n7DA3e9QT.a8hXymxI.JKnAYTLR4nD4stJtfMiCLcr7FiZ/st.', 'user', '2'),
('3', 'm@m', '1', 'MFN', 'MLN', '$2a$10$iQy1MYc97kkXBwrCJ5I9gO/QcRT.rdY6UDKriBvG.iyX29miDaKDe', 'manager', '3'),
('4', 'o@m', '1', 'OFN', 'OLN', '$2a$10$VVH6bnOWLMczmH12BY99c.T6JMzMErt/gZKRCPfYlXcq7JMFoqkWW', 'owner', '4');
# admin - pass = admin
# user - pass = user
# manager - pass = manager
# owner - pass = owner
SET FOREIGN_KEY_CHECKS=0;
INSERT INTO category (category_id, category)
VALUES ('1', 'small'), ('2', 'medium'), ('3', 'big');
INSERT INTO customer (id, address, city, email, enabled, first_name, last_name, name, phone)
VALUES ('1', 'Small Street', 'Smallville', 'smallmail@mail.com', '1', 'SmallFN', 'SmallLN', 'Small INC', '123'),
('2', 'Medium Street', 'Midtown', 'midmail@mail.com', '1', 'MidFN', 'MidLN', 'Mid INC', '456'),
('3', 'Big Street', 'Big City', 'bigmail@mail.com', '1', 'BigFN', 'BigLN', 'Big INC', '789');
INSERT INTO customer_category (customer_id, category_id)
VALUES (1, 1), (2, 2), (3, 3);
INSERT INTO contract (id, begin_date, content, end_date, name, status, value, customer_id, user_id)
VALUES ('1', '2018-02-24 00:00:00', 'contract content', '2018-02-25 00:00:00', 'ContractName', 'PROPOSED', '100000.00', '2', '2');
SET FOREIGN_KEY_CHECKS=1;

@ -0,0 +1,33 @@
customer.id = id
customer.address = address
customer.city = city
customer.email = email
customer.first.name = first name
customer.last.name = last name
customer.name = name
customer.phone = phone
ordinal.number = no.
user.username = Username
user.email = Email
user.first.name = First Name
user.last.name = Last Name
user.id = User id
user.name = User name
contract.id = id
contract.name = name
contract.content = content
contract.value = value
contract.begin.date = begin_date
contract.end.date = end_date
contract.status = status
crm.status = Status
crm.status.PROPOSED = PROPOSED
crm.status.NEGOTIATED = NEGOTIATED
crm.status.IMPLEMENTED = IMPLEMENTED
crm.status.DONE = DONE
crm.customer.name = Customer name
crm.customer.id = Customer id
crm.user.id = User id
role.id = Role id
role.name = Role name

@ -0,0 +1,11 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<title>Security with Spring Boot</title>
</head>
<body>
<h1>Access denied</h1>
<a th:href="@{/login}">Login page</a>
</body>
</html>

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Admin panel</title>
</head>
<body>
<h1>Admin panel</h1>
</body>
</html>

@ -0,0 +1,77 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Add contract</title>
</head>
<body>
<h2>Add contract form</h2>
<form th:action="@{|/contract/add|}" th:object="${contract}" method="post">
<div>
<label>
Name:
<input type="text" th:field="*{name}"/>
</label>
</div>
<div>
<label>
Content:
<input type="text" th:field="*{content}"/>
</label>
</div>
<div>
<label>
Value:
<input type="text" th:field="*{value}" placeholder="1000"/>
</label>
</div>
<div>
<label>
Begin Date:
<input type="date" th:field="*{beginDate}"/>
</label>
</div>
<div>
<label>
End date:
<input type="date" th:field="*{endDate}"/>
</label>
</div>
<div>
<label>
Status:
<select th:field="*{status}">
<option th:each="status : ${T(crm.entity.Status).ALL}"
th:value="${status}" th:text="${status}">
</option>
</select>
</label>
</div>
<div>
<label>
Customer:
<select th:field="*{customer.id}">
<option th:each="customer : ${customers}"
th:value="${customer.id}" th:text="${customer}">
</option>
</select>
</label>
</div>
<div>
<label>
User:
<select th:field="*{user.id}">
<option th:each="user : ${users}"
th:value="${user.id}" th:text="${user}">
</option>
</select>
</label>
</div>
<div>
<input type="submit" value="Add Contract"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search contract by begin date after</title>
</head>
<body>
<h2>Search contract by begin date after</h2>
<form th:action="@{|/contract/begin-date-after-search|}" th:object="${contract}" method="post">
<div>
<label>
Begin Date:
<input type="date" th:field="*{beginDate}"/>
</label>
</div>
<div>
<input type="submit" value="Search Contract"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search contract by begin date before</title>
</head>
<body>
<h2>Search contract by begin date before</h2>
<form th:action="@{|/contract/begin-date-before-search|}" th:object="${contract}" method="post">
<div>
<label>
Begin Date:
<input type="date" th:field="*{beginDate}"/>
</label>
</div>
<div>
<input type="submit" value="Search Contract"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search contract by begin date</title>
</head>
<body>
<h2>Search contract by begin date</h2>
<form th:action="@{|/contract/begin-date-search|}" th:object="${contract}" method="post">
<div>
<label>
Begin Date:
<input type="date" th:field="*{beginDate}"/>
</label>
</div>
<div>
<input type="submit" value="Search Contract"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Contracts management</title>
</head>
<body>
<h2>Contracts management</h2>
<p><a th:href="@{|/contract/search|}" th:text="'Search for contract'"></a></p>
<p><a th:href="@{|/contract/list|}" th:text="'Show contracts list'"></a></p>
<p><a th:href="@{|/contract/add|}" th:text="'Add new contract'"></a></p>
</body>
</html>

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search contracts by customer</title>
</head>
<body>
<h2>Search contracts by customer</h2>
<form th:action="@{|/contract/customer-search|}" th:object="${contract}" method="post">
<div>
<label>
Customer:
<select th:field="*{customer.id}">
<option th:each="customer : ${customers}"
th:value="${customer.id}" th:text="${customer}">
</option>
</select>
</label>
</div>
<div>
<input type="submit" value="Search Contract"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search contracts by customer and user</title>
</head>
<body>
<h2>Search contracts by customer and user</h2>
<form th:action="@{|/contract/customer-user-search|}" th:object="${contract}" method="post">
<div>
<label>
Customer:
<select th:field="*{customer.id}">
<option th:each="customer : ${customers}"
th:value="${customer.id}" th:text="${customer}">
</option>
</select>
</label>
</div>
<div>
<label>
User:
<select th:field="*{user.id}">
<option th:each="user : ${users}"
th:value="${user.id}" th:text="${user}">
</option>
</select>
</label>
</div>
<div>
<input type="submit" value="Search Contract"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,69 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Edit contract</title>
</head>
<body>
<h2>Edit contract form</h2>
<form th:action="@{|/contract/edit/${contract.id}|}" th:object="${contract}" method="post">
<div>
<label>
Name:
<input type="text" th:field="*{name}" th:value="*{name}"/>
</label>
</div>
<div>
<label>
Content:
<input type="text" th:field="*{content}" th:value="*{content}"/>
</label>
</div>
<div>
<label>
Value:
<input type="text" th:field="*{value}" th:value="*{value}"/>
</label>
</div>
<div>
<label>
Begin Date:
<input type="date" th:field="*{beginDate}" th:value="*{beginDate}"/>
</label>
</div>
<div>
<label>
End date:
<input type="date" th:field="*{endDate}" th:value="*{endDate}"/>
</label>
</div>
<div>
<label>
Status:
<select th:field="*{status}">
<option th:each="status : ${T(crm.entity.Status).ALL}"
th:value="${status}" th:text="${status}">
</option>
</select>
</label>
</div>
<div>
<label>
Customer id:
<input type="number" th:field="*{customer.id}" th:value="*{customer.id}"/>
</label>
</div>
<div>
<label>
User id:
<input type="number" th:field="*{user.id}" th:value="*{user.id}"/>
</label>
</div>
<div>
<input type="submit" value="Edit Contract"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search contract by end date after</title>
</head>
<body>
<h2>Search contract by end date after</h2>
<form th:action="@{|/contract/end-date-after-search|}" th:object="${contract}" method="post">
<div>
<label>
End Date:
<input type="date" th:field="*{endDate}"/>
</label>
</div>
<div>
<input type="submit" value="Search Contract"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search contract by end date before</title>
</head>
<body>
<h2>Search contract by end date before</h2>
<form th:action="@{|/contract/end-date-before-search|}" th:object="${contract}" method="post">
<div>
<label>
End Date:
<input type="date" th:field="*{endDate}"/>
</label>
</div>
<div>
<input type="submit" value="Search Contract"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search contract by end date</title>
</head>
<body>
<h2>Search contract by end date</h2>
<form th:action="@{|/contract/end-date-search|}" th:object="${contract}" method="post">
<div>
<label>
End Date:
<input type="date" th:field="*{endDate}"/>
</label>
</div>
<div>
<input type="submit" value="Search Contract"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
<meta charset="UTF-8"/>
<title>Contracts</title>
</head>
<body>
<table>
<thead>
<tr>
<th><a th:text="#{contract.id}"></a></th>
<th><a th:text="#{contract.name}"></a></th>
<th><a th:text="#{contract.content}"></a></th>
<th><a th:text="#{contract.value}"></a></th>
<th><a th:text="#{contract.begin.date}"></a></th>
<th><a th:text="#{contract.end.date}"></a></th>
<th><a th:text="#{contract.status}"></a></th>
<th><a th:text="#{crm.customer.name}"></a></th>
<th><a th:text="#{user.name}"></a></th>
<th></th>
</tr>
</thead>
<tbody>
<tr th:each="contract : ${contracts}">
<td th:text="${contract.id}"></td>
<td th:text="${contract.name}"></td>
<td th:text="${contract.content}"></td>
<td th:text="${contract.value}"></td>
<td th:text="${#temporals.format(contract.beginDate, 'dd.MM.yyyy')}"></td>
<td th:text="${#temporals.format(contract.endDate, 'dd.MM.yyyy')}"></td>
<td th:text="${contract.status}"></td>
<td th:text="${contract.customer.name}"></td>
<td th:text="${contract.user.name}"></td>
<p sec:authorize="hasAnyRole('ROLE_MANAGER', 'ROLE_OWNER')">
<td><a th:href="@{|/contract/edit/${contract.id}|}">Edit</a></td>
</p>
</tr>
</tbody>
</table>
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search for contract</title>
</head>
<body>
<h2>Search contract by Name</h2>
<form th:action="@{|/contract/name-search|}" th:object="${contract}" method="post">
<div>
<label>
Name:
<input type="text" th:field="*{name}"/>
</label>
</div>
<div>
<input type="submit" value="Search Contract"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Choose searching type</title>
</head>
<body>
<h2>Choose searching type</h2>
<p><a th:href="@{|/contract/name-search|}" th:text="'Search for contract by Name'"></a></p>
<p><a th:href="@{|/contract/value-le-search|}" th:text="'Search for contracts by Value Less Than Equal'"></a></p>
<p><a th:href="@{|/contract/value-ge-search|}" th:text="'Search for contracts by Value Greater Than Equal'"></a></p>
<p><a th:href="@{|/contract/begin-date-search|}" th:text="'Search for contracts by Begin Date'"></a></p>
<p><a th:href="@{|/contract/begin-date-before-search|}" th:text="'Search for contracts by Begin Date Before'"></a></p>
<p><a th:href="@{|/contract/begin-date-after-search|}" th:text="'Search for contracts by Begin Date After'"></a></p>
<p><a th:href="@{|/contract/end-date-search|}" th:text="'Search for contracts by End Date'"></a></p>
<p><a th:href="@{|/contract/end-date-before-search|}" th:text="'Search for contracts by End Date Before'"></a></p>
<p><a th:href="@{|/contract/end-date-after-search|}" th:text="'Search for contracts by End Date After'"></a></p>
<p><a th:href="@{|/contract/status-search|}" th:text="'Search for contracts by Status'"></a></p>
<p><a th:href="@{|/contract/customer-search|}" th:text="'Search for contracts by Customer'"></a></p>
<p><a th:href="@{|/contract/customer-user-search|}" th:text="'Search for contracts by Customer and User'"></a></p>
<p><a th:href="@{|/contract/user-search|}" th:text="'Search for contracts by User'"></a></p>
</body>
</html>

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Searching result</title>
</head>
<body>
<table>
<thead>
<tr>
<th><a th:text="#{contract.id}"></a></th>
<th><a th:text="#{contract.name}"></a></th>
<th><a th:text="#{contract.content}"></a></th>
<th><a th:text="#{contract.value}"></a></th>
<th><a th:text="#{contract.begin.date}"></a></th>
<th><a th:text="#{contract.end.date}"></a></th>
<th><a th:text="#{contract.status}"></a></th>
<th><a th:text="#{crm.customer.name}"></a></th>
<th><a th:text="#{user.name}"></a></th>
</tr>
</thead>
<tbody>
<tr th:each="contract : ${contracts}">
<td th:text="${contract.id}"></td>
<td th:text="${contract.name}"></td>
<td th:text="${contract.content}"></td>
<td th:text="${contract.value}"></td>
<td th:text="${#temporals.format(contract.beginDate, 'dd.MM.yyyy')}"></td>
<td th:text="${#temporals.format(contract.endDate, 'dd.MM.yyyy')}"></td>
<td th:text="${contract.status}"></td>
<td th:text="${contract.customer.name}"></td>
<td th:text="${contract.user.name}"></td>
</tr>
</tbody>
</table>
</body>
</html>

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Searching result</title>
</head>
<body>
<table>
<thead>
<tr>
<th><a th:text="#{contract.id}"></a></th>
<th><a th:text="#{contract.name}"></a></th>
<th><a th:text="#{contract.content}"></a></th>
<th><a th:text="#{contract.value}"></a></th>
<th><a th:text="#{contract.begin.date}"></a></th>
<th><a th:text="#{contract.end.date}"></a></th>
<th><a th:text="#{contract.status}"></a></th>
<th><a th:text="#{crm.customer.name}"></a></th>
<th><a th:text="#{user.name}"></a></th>
</tr>
</thead>
<tbody>
<tr th:object="${contract}">
<td th:text="*{id}"></td>
<td th:text="*{name}"></td>
<td th:text="*{content}"></td>
<td th:text="*{value}"></td>
<td th:text="*{beginDate}"></td>
<td th:text="*{endDate}"></td>
<td th:text="*{status}"></td>
<td th:text="*{customer.name}"></td>
<td th:text="*{user.name}"></td>
</tr>
</tbody>
</table>
</body>
</html>

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search contract by status</title>
</head>
<body>
<h2>Search contract by status</h2>
<form th:action="@{|/contract/status-search|}" th:object="${contract}" method="post">
<div>
<label>
Status:
<select th:field="*{status}">
<option th:each="status : ${T(crm.entity.Status).ALL}"
th:value="${status}" th:text="${status}">
</option>
</select>
</label>
</div>
<div>
<input type="submit" value="Search Contract"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Success</title>
</head>
<body>
<h2>Contract successfully added to database</h2>
</body>
</html>

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search contracts by user</title>
</head>
<body>
<h2>Search contracts by user</h2>
<form th:action="@{|/contract/user-search|}" th:object="${contract}" method="post">
<div>
<label>
User:
<select th:field="*{user.id}">
<option th:each="user : ${users}"
th:value="${user.id}" th:text="${user}">
</option>
</select>
</label>
</div>
<div>
<input type="submit" value="Search Contract"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search contract by value greater equal than</title>
</head>
<body>
<h2>Search contract by value greater equal than</h2>
<form th:action="@{|/contract/value-ge-search|}" th:object="${contract}" method="post">
<div>
<label>
Value:
<input type="text" th:field="*{value}"/>
</label>
</div>
<div>
<input type="submit" value="Search Contract"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search contract by value less equal than</title>
</head>
<body>
<h2>Search contract by value less equal than</h2>
<form th:action="@{|/contract/value-le-search|}" th:object="${contract}" method="post">
<div>
<label>
Value:
<input type="text" th:field="*{value}"/>
</label>
</div>
<div>
<input type="submit" value="Search Contract"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Title</title>
</head>
<body>
<!--<p><a th:href="@{|/import|}" th:text="'Import CSV file'"></a></p>-->
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>CSV show</title>
</head>
<body>
<table>
<thead>
<tr>
<th>ROW</th>
</tr>
</thead>
<tbody>
<tr th:each="d : ${data}">
<td th:text="${d}"></td>
</tr>
</tbody>
</table>
</body>
</html>

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Add new customer based on another one</title>
</head>
<body>
<h2>Add new customer based on another one form</h2>
<form th:action="@{|/customer/addCustomerBasedOnAnotherOne/${customer.id}|}" th:object="${customer}" method="post">
<div>
<label>
Name:
<input type="text" th:field="*{name}" th:value="*{name}"/>
</label>
</div>
<div>
<label>
E-mail:
<input type="email" th:field="*{email}" th:value="*{email}"/>
</label>
</div>
<div>
<label>
Phone:
<input type="number" th:field="*{phone}" th:value="*{phone}"/>
</label>
</div>
<div>
<label>
First Name:
<input type="text" th:field="*{firstName}" th:value="*{firstName}"/>
</label>
</div>
<div>
<label>
Last Name:
<input type="text" th:field="*{lastName}" th:value="*{lastName}"/>
</label>
</div>
<div>
<label>
Address:
<input type="text" th:field="*{address}" th:value="*{address}"/>
</label>
</div>
<div>
<label>
City:
<input type="text" th:field="*{city}" th:value="*{city}"/>
</label>
</div>
<div>
<input type="submit" value="Add New Customer"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Add customer</title>
</head>
<body>
<h2>Add customer form</h2>
<form th:action="@{|/customer/add|}" th:object="${customer}" method="post">
<div>
<label>
Name:
<input type="text" th:field="*{name}"/>
</label>
</div>
<div>
<label>
E-mail:
<input type="email" th:field="*{email}"/>
</label>
</div>
<div>
<label>
Phone:
<input type="number" th:field="*{phone}"/>
</label>
</div>
<div>
<label>
First Name:
<input type="text" th:field="*{firstName}"/>
</label>
</div>
<div>
<label>
Last Name:
<input type="text" th:field="*{lastName}"/>
</label>
</div>
<div>
<label>
Address:
<input type="text" th:field="*{address}"/>
</label>
</div>
<div>
<label>
City:
<input type="text" th:field="*{city}"/>
</label>
</div>
<div>
<input type="submit" value="Add Customer"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search for customer</title>
</head>
<body>
<h2>Search customer by City and Address</h2>
<form th:action="@{|/customer/city-address-search|}" th:object="${customer}" method="post">
<div>
<label>
City:
<input type="text" th:field="*{city}"/>
</label>
</div>
<div>
<label>
Address:
<input type="text" th:field="*{address}"/>
</label>
</div>
<div>
<input type="submit" value="Search Customer"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search for customer</title>
</head>
<body>
<h2>Search customer by City</h2>
<form th:action="@{|/customer/city-search|}" th:object="${customer}" method="post">
<div>
<label>
City:
<input type="text" th:field="*{city}"/>
</label>
</div>
<div>
<input type="submit" value="Search Customer"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Customers management</title>
</head>
<body>
<h2>Customers management</h2>
<p><a th:href="@{|/search|}" th:text="'Search for customers'"></a></p>
<p><a th:href="@{|/customer/list|}" th:text="'Show customers list'"></a></p>
<p><a th:href="@{|/customer/add|}" th:text="'Add new customer'"></a></p>
</body>
</html>

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Edit customer</title>
</head>
<body>
<h2>Edit customer form</h2>
<form th:action="@{|/customer/edit/${customer.id}|}" th:object="${customer}" method="post">
<div>
<label>
Name:
<input type="text" th:field="*{name}" th:value="*{name}"/>
</label>
</div>
<div>
<label>
E-mail:
<input type="email" th:field="*{email}" th:value="*{email}"/>
</label>
</div>
<div>
<label>
Phone:
<input type="number" th:field="*{phone}" th:value="*{phone}"/>
</label>
</div>
<div>
<label>
First Name:
<input type="text" th:field="*{firstName}" th:value="*{firstName}"/>
</label>
</div>
<div>
<label>
Last Name:
<input type="text" th:field="*{lastName}" th:value="*{lastName}"/>
</label>
</div>
<div>
<label>
Address:
<input type="text" th:field="*{address}" th:value="*{address}"/>
</label>
</div>
<div>
<label>
City:
<input type="text" th:field="*{city}" th:value="*{city}"/>
</label>
</div>
<div>
<input type="submit" value="Edit Customer"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search for customer</title>
</head>
<body>
<h2>Search customer by Email</h2>
<form th:action="@{|/customer/email-search|}" th:object="${customer}" method="post">
<div>
<label>
E-mail:
<input type="email" th:field="*{email}"/>
</label>
</div>
<div>
<input type="submit" value="Search Customer"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search for customer</title>
</head>
<body>
<h2>Search customer by First Name and Last Name</h2>
<form th:action="@{|/customer/first-name-last-name-search|}" th:object="${customer}" method="post">
<div>
<label>
First Name:
<input type="text" th:field="*{firstName}"/>
</label>
</div>
<div>
<label>
Last Name:
<input type="text" th:field="*{lastName}"/>
</label>
</div>
<div>
<input type="submit" value="Search Customer"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search for customer</title>
</head>
<body>
<h2>Search customer by First Name</h2>
<form th:action="@{|/customer/first-name-search|}" th:object="${customer}" method="post">
<div>
<label>
First Name:
<input type="text" th:field="*{firstName}"/>
</label>
</div>
<div>
<input type="submit" value="Search Customer"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search for customer</title>
</head>
<body>
<h2>Search customer by Last Name</h2>
<form th:action="@{|/customer/last-name-search|}" th:object="${customer}" method="post">
<div>
<label>
Last Name:
<input type="text" th:field="*{lastName}"/>
</label>
</div>
<div>
<input type="submit" value="Search Customer"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Customers</title>
</head>
<body>
<table>
<thead>
<tr>
<th><a th:text="#{customer.id}"></a></th>
<th><a th:text="#{customer.name}"></a></th>
<th><a th:text="#{customer.email}"></a></th>
<th><a th:text="#{customer.phone}"></a></th>
<th><a th:text="#{customer.first.name}"></a></th>
<th><a th:text="#{customer.last.name}"></a></th>
<th><a th:text="#{customer.address}"></a></th>
<th><a th:text="#{customer.city}"></a></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr th:each="customer : ${customers}">
<td th:text="${customer.id}"></td>
<td th:text="${customer.name}"></td>
<td th:text="${customer.email}"></td>
<td th:text="${customer.phone}"></td>
<td th:text="${customer.firstName}"></td>
<td th:text="${customer.lastName}"></td>
<td th:text="${customer.address}"></td>
<td th:text="${customer.city}"></td>
<td><a th:href="@{|/customer/edit/${customer.id}|}">Edit</a></td>
<td><a th:href="@{|/customer/addCustomerBasedOnAnotherOne/${customer.id}|}">Add new customer based on this</a></td>
</tr>
</tbody>
</table>
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search for customer</title>
</head>
<body>
<h2>Search customer by Name</h2>
<form th:action="@{|/customer/name-search|}" th:object="${customer}" method="post">
<div>
<label>
Name:
<input type="text" th:field="*{name}"/>
</label>
</div>
<div>
<input type="submit" value="Search Customer"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Search for customer</title>
</head>
<body>
<h2>Search customer by Phone</h2>
<form th:action="@{|/customer/phone-search|}" th:object="${customer}" method="post">
<div>
<label>
Phone:
<input type="number" th:field="*{phone}"/>
</label>
</div>
<div>
<input type="submit" value="Search Customer"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Searching result</title>
</head>
<body>
<table>
<thead>
<tr>
<th><a th:text="#{customer.id}"></a></th>
<th><a th:text="#{customer.address}"></a></th>
<th><a th:text="#{customer.city}"></a></th>
<th><a th:text="#{customer.email}"></a></th>
<th><a th:text="#{customer.first.name}"></a></th>
<th><a th:text="#{customer.last.name}"></a></th>
<th><a th:text="#{customer.name}"></a></th>
<th><a th:text="#{customer.phone}"></a></th>
</tr>
</thead>
<tbody>
<tr th:each="customer : ${customers}">
<td th:text="${customer.id}"></td>
<td th:text="${customer.address}"></td>
<td th:text="${customer.city}"></td>
<td th:text="${customer.email}"></td>
<td th:text="${customer.firstName}"></td>
<td th:text="${customer.lastName}"></td>
<td th:text="${customer.name}"></td>
<td th:text="${customer.phone}"></td>
</tr>
</tbody>
</table>
</body>
</html>

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Searching result</title>
</head>
<body>
<table>
<thead>
<tr>
<th><a th:text="#{customer.id}"></a></th>
<th><a th:text="#{customer.address}"></a></th>
<th><a th:text="#{customer.city}"></a></th>
<th><a th:text="#{customer.email}"></a></th>
<th><a th:text="#{customer.first.name}"></a></th>
<th><a th:text="#{customer.last.name}"></a></th>
<th><a th:text="#{customer.name}"></a></th>
<th><a th:text="#{customer.phone}"></a></th>
</tr>
</thead>
<tbody>
<tr th:object="${customer}">
<td th:text="*{id}"></td>
<td th:text="*{address}"></td>
<td th:text="*{city}"></td>
<td th:text="*{email}"></td>
<td th:text="*{firstName}"></td>
<td th:text="*{lastName}"></td>
<td th:text="*{name}"></td>
<td th:text="*{phone}"></td>
</tr>
</tbody>
</table>
</body>
</html>

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Success</title>
</head>
<body>
<h2>Customer successfully added to database</h2>
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Date test</title>
</head>
<body>
<h1>Date test</h1>
<h2>Format ISO</h2>
<p th:text="${#dates.formatISO(standardDate)}"></p>
<p th:text="${#temporals.formatISO(localDateTime)}"></p>
<p th:text="${#temporals.formatISO(localDate)}"></p>
<p th:text="${#temporals.formatISO(timestamp)}"></p>
<h2>Format manually</h2>
<p th:text="${#dates.format(standardDate, 'dd-MM-yyyy HH:mm')}"></p>
<p th:text="${#temporals.format(localDateTime, 'dd-MM-yyyy HH:mm')}"></p>
<p th:text="${#temporals.format(localDate, 'MM-yyyy')}"></p>
</body>
</html>

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
<meta charset="UTF-8"/>
<title>Home page</title>
</head>
<body>
<h1>Home page</h1>
<a sec:authorize="hasRole('ROLE_ANONYMOUS')">
<p>Login = user, Password = user</p>
<p>Login = manager, Password = manager</p>
<p>Login = owner, Password = owner</p>
<p>Login = admin, Password = admin</p>
<p>User has some restrictions. Only manager and owner can edit contracts. Only admin can delete users.</p>
<p><a th:href="@{|/login|}" th:text="'Log in'"></a></p>
<p><a th:href="@{|/register|}" th:text="'Register'"></a></p>
</a>
<a sec:authorize="isAuthenticated()">
<p><a th:href="@{|/user/menu|}" th:text="'User menu'"></a></p>
<p><a th:href="@{|/customer/menu|}" th:text="'Customer menu'"></a></p>
<p><a th:href="@{|/contract/menu|}" th:text="'Contract menu'"></a></p>
<p><a th:href="@{|/pdf-generator|}" th:text="'Simple pdf generator'"></a></p>
<!--<p><a th:href="@{|/import|}" th:text="'Import CSV file'"></a></p>-->
<p>Logged as: <span sec:authentication="name"></span></p>
<p>Has role: <span sec:authentication="authorities"></span></p>
<a th:href="@{/logout}">Log out</a>
</a>
</body>
</html>

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<body>
<h1>Custom login page</h1>
<form th:action="@{/login}" method="post">
<div><label> User Name : <input type="text" name="username"/> </label></div>
<div><label> Password: <input type="password" name="password"/> </label></div>
<div><input type="submit" value="Sign In"/></div>
</form>
</body>
</html>

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<body>
<h1 th:inline="text">Hello in options</h1>
<form th:action="@{/logout}" method="post">
<input type="submit" value="Log Out"/>
</form>
</body>
</html>

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Document generator</title>
</head>
<body>
<h3>Enter the data to generate the document</h3>
<form th:action="@{/pdf-generator}" th:object="${pdf}" method="post" id="pdfform">
<div>
<input type="hidden" th:field="*{id}" />
</div>
<div>
<label>
File name:
<input type="text" th:field="*{name}"/>
</label>
</div>
<div>
<input type="submit" value="Generate pdf"/>
</div>
</form>
<textarea form ="pdfform" name="taname" id="taid" cols="35" wrap="soft" th:field="${pdf.content}"></textarea>
</body>
</html>

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Success</title>
</head>
<body>
<h2>Pdf successfully created.</h2>
<p>File is saved in project main folder</p>
</body>
</html>

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Register</title>
</head>
<body>
<h2>Register</h2>
<form th:action="@{/register}" th:object="${user}" method="post">
<div>
<input type="hidden" th:field="*{id}" />
</div>
<div>
<label>
Username:
<input type="text" th:field="*{username}"/>
</label>
</div>
<div>
<label>
Email:
<input type="email" th:field="*{email}"/>
</label>
</div>
<div>
<label>
Password:
<input type="password" th:field="*{password}"/>
</label>
</div>
<div>
<label>
First Name:
<input type="text" th:field="*{firstName}"/>
</label>
</div>
<div>
<label>
Last Name:
<input type="text" th:field="*{lastName}"/>
</label>
</div>
<div>
<input type="submit" value="Register"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Choose searching type</title>
</head>
<body>
<h2>Choose searching type</h2>
<p><a th:href="@{|/customer/name-search|}" th:text="'Search for customers by Name'"></a></p>
<p><a th:href="@{|/customer/email-search|}" th:text="'Search for customers by Email'"></a></p>
<p><a th:href="@{|/customer/phone-search|}" th:text="'Search for customers by Phone'"></a></p>
<p><a th:href="@{|/customer/first-name-search|}" th:text="'Search for customers by First Name'"></a></p>
<p><a th:href="@{|/customer/last-name-search|}" th:text="'Search for customers by Last Name'"></a></p>
<p><a th:href="@{|/customer/first-name-last-name-search|}" th:text="'Search for customers by First Name and Last Name'"></a></p>
<p><a th:href="@{|/customer/city-search|}" th:text="'Search for customers by City'"></a></p>
<p><a th:href="@{|/customer/city-address-search|}" th:text="'Search for customers by City and Address'"></a></p>
</body>
</html>

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Success</title>
</head>
<body>
<h2>User successfully added to database</h2>
</body>
</html>

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
<meta charset="UTF-8"/>
<title>Edit user</title>
</head>
<body>
<h2>Edit user form</h2>
<form th:action="@{|/user/edit/${user.id}|}" th:object="${user}" method="post">
<div>
<label>
Username:
<input type="text" th:field="*{username}" th:value="*{username}"/>
</label>
</div>
<div>
<label>
E-mail:
<input type="email" th:field="*{email}" th:value="*{email}"/>
</label>
</div>
<div>
<label>
First Name:
<input type="text" th:field="*{firstName}" th:value="*{firstName}"/>
</label>
</div>
<div>
<label>
Last Name:
<input type="text" th:field="*{lastName}" th:value="*{lastName}"/>
</label>
</div>
<div>
<label>
Password:
<input type="password" th:field="*{password}" th:value="*{password}"/>
</label>
</div>
<p sec:authorize="hasAnyRole('ROLE_MANAGER', 'ROLE_OWNER', 'ROLE_ADMIN')">
<div>
<label>
Role:
<input type="text" th:field="*{role.id}" th:value="*{role.id}"/>
</label>
</div>
</p>
<div>
<input type="submit" value="Edit User"/>
</div>
</form>
</body>
</html>

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
<meta charset="UTF-8"/>
<title>Users</title>
</head>
<body>
<table>
<thead>
<tr>
<th><a th:text="#{ordinal.number}"></a></th>
<th><a th:text="#{user.username}"></a></th>
<th><a th:text="#{user.email}"></a></th>
<th><a th:text="#{user.first.name}"></a></th>
<th><a th:text="#{user.last.name}"></a></th>
<th><a th:text="#{role.id}"></a></th>
<th><a th:text="#{role.name}"></a></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr th:each="user, iterStat : ${users}">
<td th:text="${iterStat.count}"></td>
<td th:text="${user.username}"></td>
<td th:text="${user.email}"></td>
<td th:text="${user.firstName}"></td>
<td th:text="${user.lastName}"></td>
<td th:text="${user.role.id}"></td>
<td th:text="${user.role.name}"></td>
<p sec:authorize="hasAnyRole('ROLE_USER', 'ROLE_MANAGER')">
<td><a th:if="${currentUser.equals(user)}" th:href="@{|/user/edit/${user.id}|}">Edit</a></td>
</p>
<p sec:authorize="hasAnyRole('ROLE_OWNER', 'ROLE_ADMIN')">
<td><a th:href="@{|/user/edit/${user.id}|}">Edit</a></td>
</p>
<p sec:authorize="hasRole('ROLE_ADMIN')">
<td><a th:unless="${currentUser.equals(user)}" th:href="@{|/user/delete/${user.id}|}">Delete</a></td>
</p>
</tr>
</tbody>
</table>
<p><a th:href="@{|/download.pdf|}" th:text="'Download users list in PDF file'"></a></p>
<p><a th:href="@{|/download.xls|}" th:text="'Download users list in XLS file'"></a></p>
<p><a th:href="@{|/download.csv|}" th:text="'Download users list in CSV file'"></a></p>
<p sec:authorize="isAuthenticated()">
<p>Logged as: <span sec:authentication="name"></span></p>
<p>Has role: <span sec:authentication="authorities"></span></p>
</p>
<span sec:authorize="isAuthenticated()">
<a th:href="@{/logout}">Log out</a>
</span>
</body>
</html>

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Success</title>
</head>
<body>
<h2>User successfully added to database</h2>
</body>
</html>

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title>Users management</title>
</head>
<body>
<h2>Users management</h2>
<p><a th:href="@{|/user/list|}" th:text="'Show users list'"></a></p>
</body>
</html>

@ -0,0 +1,16 @@
package crm;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class CrmApplicationTests {
@Test
public void contextLoads() {
}
}
Loading…
Cancel
Save