diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..2dc9bcc
Binary files /dev/null and b/.DS_Store differ
diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..fd9975d
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b83d222
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/.project b/.project
new file mode 100644
index 0000000..23a052b
--- /dev/null
+++ b/.project
@@ -0,0 +1,43 @@
+
+
+ TireShop-Demo
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+ org.springframework.ide.eclipse.core.springbuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.springframework.ide.eclipse.core.springnature
+ org.eclipse.jem.workbench.JavaEMFNature
+ org.eclipse.wst.common.modulecore.ModuleCoreNature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+ org.eclipse.wst.common.project.facet.core.nature
+ org.eclipse.wst.jsdt.core.jsNature
+
+
diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope
new file mode 100644
index 0000000..f179e11
--- /dev/null
+++ b/.settings/.jsdtscope
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..6e80039
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
new file mode 100644
index 0000000..0b99cd0
--- /dev/null
+++ b/.settings/org.eclipse.wst.common.component
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 0000000..6bdc57d
--- /dev/null
+++ b/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container
new file mode 100644
index 0000000..3bd5d0a
--- /dev/null
+++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container
@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.name b/.settings/org.eclipse.wst.jsdt.ui.superType.name
new file mode 100644
index 0000000..05bd71b
--- /dev/null
+++ b/.settings/org.eclipse.wst.jsdt.ui.superType.name
@@ -0,0 +1 @@
+Window
\ No newline at end of file
diff --git a/.settings/org.eclipse.wst.validation.prefs b/.settings/org.eclipse.wst.validation.prefs
new file mode 100644
index 0000000..04cad8c
--- /dev/null
+++ b/.settings/org.eclipse.wst.validation.prefs
@@ -0,0 +1,2 @@
+disabled=06target
+eclipse.preferences.version=1
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7125830
--- /dev/null
+++ b/README.md
@@ -0,0 +1,45 @@
+# Tireshop Maven Application
+# project Technology
+* spring mvc
+* spring Rest Api
+* hibernate
+* mysql
+* spring secrity
+* bootsrap
+* slick carsoual
+# Project Module
+1. Battry
+2. Rimes
+3. Tires
+4. User
+5. Suppliers
+4. Sales
+5. Budget
+6. Supplying
+
+# login Page
+### Spring Security Custom Login
+* It validates the user credentials and provide accessibility into the application.
+* save password encryption in Database
+
+
+
+# Home Page
+* statistics Card Contain Total Items and Total Price for each product
+* Carsoual product inculde Tires ,Rimes and Tires
+* Top Sales Product
+* Top Refill Product
+
+
+
+# Project Version
+### poem.xml
+
+```xml
+5.0.6.RELEASE
+5.0.0.RELEASE
+5.4.2.Final
+8.0.16
+0.9.5.4
+1.8
+```
diff --git a/ScreenShot/Screenshot_2020-03-06 Battries.png b/ScreenShot/Screenshot_2020-03-06 Battries.png
new file mode 100644
index 0000000..01afb03
Binary files /dev/null and b/ScreenShot/Screenshot_2020-03-06 Battries.png differ
diff --git a/ScreenShot/Screenshot_2020-03-06 Budgets Main.png b/ScreenShot/Screenshot_2020-03-06 Budgets Main.png
new file mode 100644
index 0000000..1705a2f
Binary files /dev/null and b/ScreenShot/Screenshot_2020-03-06 Budgets Main.png differ
diff --git a/ScreenShot/Screenshot_2020-03-06 Home.png b/ScreenShot/Screenshot_2020-03-06 Home.png
new file mode 100644
index 0000000..8d0db8c
Binary files /dev/null and b/ScreenShot/Screenshot_2020-03-06 Home.png differ
diff --git a/ScreenShot/Screenshot_2020-03-06 Login Page.png b/ScreenShot/Screenshot_2020-03-06 Login Page.png
new file mode 100644
index 0000000..837bd63
Binary files /dev/null and b/ScreenShot/Screenshot_2020-03-06 Login Page.png differ
diff --git a/ScreenShot/Screenshot_2020-03-06 Sales Main.png b/ScreenShot/Screenshot_2020-03-06 Sales Main.png
new file mode 100644
index 0000000..b2197e2
Binary files /dev/null and b/ScreenShot/Screenshot_2020-03-06 Sales Main.png differ
diff --git a/bin/.settings/org.eclipse.wst.common.component b/bin/.settings/org.eclipse.wst.common.component
new file mode 100644
index 0000000..bcdef64
--- /dev/null
+++ b/bin/.settings/org.eclipse.wst.common.component
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bin/target/m2e-wtp/web-resources/META-INF/maven/com.webapp/TireShop/pom.properties b/bin/target/m2e-wtp/web-resources/META-INF/maven/com.webapp/TireShop/pom.properties
new file mode 100644
index 0000000..94a5618
--- /dev/null
+++ b/bin/target/m2e-wtp/web-resources/META-INF/maven/com.webapp/TireShop/pom.properties
@@ -0,0 +1,7 @@
+#Generated by Maven Integration for Eclipse
+#Tue Feb 11 02:15:39 EET 2020
+version=1.0
+groupId=com.webapp
+m2e.projectName=TireShop-Demo
+m2e.projectLocation=H\:\\WorkSpace\\Eclipse projects Spring\\TireShop-Demo
+artifactId=TireShop
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..4520609
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,145 @@
+
+
+ 4.0.0
+ com.webapp
+ TireShop
+ 1.0
+ war
+
+ TireShop
+
+
+ 5.0.6.RELEASE
+ 5.0.0.RELEASE
+ 5.4.2.Final
+ 8.0.16
+ 0.9.5.4
+
+ 1.8
+ 1.8
+
+
+
+
+
+ org.springframework
+ spring-webmvc
+ ${springframework.version}
+
+
+ org.springframework
+ spring-tx
+ ${springframework.version}
+
+
+
+ org.springframework
+ spring-orm
+ ${springframework.version}
+
+
+
+
+
+ org.springframework.security
+ spring-security-web
+ ${springsecurity.version}
+
+
+
+ org.springframework.security
+ spring-security-config
+ ${springsecurity.version}
+
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.9.5
+
+
+
+
+ org.hibernate
+ hibernate-core
+ ${hibernate.version}
+
+
+
+
+ mysql
+ mysql-connector-java
+ ${mysql.connector.version}
+
+
+
+
+ com.mchange
+ c3p0
+ ${c3po.version}
+
+
+
+
+ javax.servlet
+ javax.servlet-api
+ 3.1.0
+
+
+
+ javax.servlet.jsp
+ javax.servlet.jsp-api
+ 2.3.1
+
+
+
+ javax.servlet
+ jstl
+ 1.2
+
+
+
+
+
+ javax.xml.bind
+ jaxb-api
+ 2.3.0
+
+
+
+ junit
+ junit
+ 3.8.1
+ test
+
+
+
+
+ org.apache.poi
+ poi
+ 4.1.2
+
+
+
+
+
+
+
+ TireShop
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 3.2.0
+
+
+
+
+
+
+
diff --git a/src/.DS_Store b/src/.DS_Store
new file mode 100644
index 0000000..f610bfe
--- /dev/null
+++ b/src/.DS_Store
@@ -0,0 +1,78 @@
+="_fj_hlUgKEeqxwePLTb12JA" selectedElement="_fj_hlkgKEeqxwePLTb12JA" horizontal="true">
+
+ active
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ persp.actionSet:org.eclipse.ui.cheatsheets.actionSet
+ persp.actionSet:org.eclipse.rse.core.search.searchActionSet
+ persp.actionSet:org.eclipse.search.searchActionSet
+ persp.actionSet:org.eclipse.ui.edit.text.actionSet.annotationNavigation
+ persp.actionSet:org.eclipse.ui.edit.text.actionSet.navigation
+ persp.actionSet:org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo
+ persp.actionSet:org.eclipse.ui.externaltools.ExternalToolsSet
+ persp.actionSet:org.eclipse.ui.actionSet.keyBindings
+ persp.actionSet:org.eclipse.ui.actionSet.openFiles
+ persp.actionSet:org.eclipse.mylyn.doc.actionSet
+ persp.actionSet:org.eclipse.mylyn.tasks.ui.navigation
+ persp.actionSet:org.springframework.ide.eclipse.aop.ui.ActionSet
+ persp.actionSet:org.springframework.ide.eclipse.aop.ui.matcher.actionSet
+ persp.actionSet:org.springframework.ide.eclipse.beans.ui.actionSet
+ persp.actionSet:org.springframework.ide.eclipse.beans.search.actionSet
+ persp.actionSet:org.springsource.ide.eclipse.commons.launch.actionSet
+ persp.actionSet:org.eclipse.debug.ui.launchActionSet
+ persp.actionSet:org.eclipse.jdt.ui.JavaActionSet
+ persp.actionSet:org.eclipse.jdt.ui.JavaElementCreationActionSet
+ persp.actionSet:org.eclipse.ui.NavigateActionSet
+ persp.viewSC:org.eclipse.jdt.ui.PackageExplorer
+ persp.viewSC:org.eclipse.jdt.ui.TypeHierarchy
+ persp.viewSC:org.eclipse.jdt.ui.SourceView
+ persp.viewSC:org.eclipse.jdt.ui.JavadocView
+ persp.viewSC:org.eclipse.search.ui.views.SearchView
+ persp.viewSC:org.eclipse.ui.console.ConsoleView
+ persp.viewSC:org.eclipse.ui.views.ContentOutline
+ persp.viewSC:org.eclipse.ui.views.ProblemView
+ persp.viewSC:org.eclipse.ui.views.ResourceNavigator
+ persp.viewSC:org.eclipse.ui.views.TaskList
+ persp.viewSC:org.eclipse.ui.views.ProgressView
+ persp.viewSC:org.eclipse.ui.navigator.ProjectExplorer
+ persp.viewSC:org.eclipse.ui.texteditor.TemplatesView
+ persp.viewSC:org.eclipse.pde.runtime.LogView
+ persp.newWizSC:org.eclipse.jdt.ui.wizards.JavaProjectWizard
+ persp.newWizSC:org.eclipse.jdt.ui.wizards.NewPackageCreationWizard
+ persp.newWizSC:org.eclipse.jdt.ui.wizards.NewClassCreationWizard
+ persp.newWizSC:org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard
+ persp.newWizSC:org.eclipse.jdt.ui.wizards.NewEnumCreationWizard
+ persp.newWizSC:org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard
+ persp.newWizSC:org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard
+ persp.newWizSC:org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard
+ persp.newWizSC:org.eclipse.jdt.ui.wizards.NewJavaWorkingSetWizard
+ persp.newWizSC:org.eclipse.ui.wizards.new.folder
+ persp.newWizSC:org.eclipse.ui.wizards.new.file
+ persp.newWizSC:org.eclipse.ui.editors.wizards.UntitledTextFileWizard
+ persp.perspSC:org.eclipse.jdt.ui.JavaBrowsingPerspective
+ persp.perspSC:org.eclipse.debug.ui.DebugPerspective
+ persp.viewSC:org.eclipse.ant.ui.views.AntView
+ persp.showI
\ No newline at end of file
diff --git a/src/main/.DS_Store b/src/main/.DS_Store
new file mode 100644
index 0000000..5ed5cba
Binary files /dev/null and b/src/main/.DS_Store differ
diff --git a/src/main/java/com/.DS_Store b/src/main/java/com/.DS_Store
new file mode 100644
index 0000000..df85b0d
Binary files /dev/null and b/src/main/java/com/.DS_Store differ
diff --git a/src/main/java/com/webapp/config/DemoAppConfig.java b/src/main/java/com/webapp/config/DemoAppConfig.java
new file mode 100644
index 0000000..aa69f6d
--- /dev/null
+++ b/src/main/java/com/webapp/config/DemoAppConfig.java
@@ -0,0 +1,162 @@
+package com.webapp.config;
+
+import java.beans.PropertyVetoException;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+import javax.sql.DataSource;
+
+import org.hibernate.SessionFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.core.env.Environment;
+import org.springframework.orm.hibernate5.HibernateTransactionManager;
+import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.springframework.web.servlet.ViewResolver;
+import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.view.InternalResourceViewResolver;
+
+import com.mchange.v2.c3p0.ComboPooledDataSource;
+
+@Configuration
+@EnableWebMvc
+@EnableTransactionManagement
+@ComponentScan(basePackages="com.webapp")
+@PropertySource({ "classpath:persistence-mysql.properties" })
+public class DemoAppConfig implements WebMvcConfigurer{
+
+ @Autowired
+ private Environment env;
+
+ private Logger logger = Logger.getLogger(getClass().getName());
+
+ // define a bean for ViewResolver
+
+ @Bean
+ public ViewResolver viewResolver() {
+
+ InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
+
+ viewResolver.setPrefix("/WEB-INF/view/");
+ viewResolver.setSuffix(".jsp");
+
+ return viewResolver;
+ }
+
+ @Override
+
+ public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
+
+ configurer.enable();
+
+ }
+
+ @Bean
+ public DataSource myDataSource() {
+
+ // create connection pool
+ ComboPooledDataSource myDataSource = new ComboPooledDataSource();
+
+ // set the jdbc driver
+ try {
+ myDataSource.setDriverClass("com.mysql.jdbc.Driver");
+ }
+ catch (PropertyVetoException exc) {
+ throw new RuntimeException(exc);
+ }
+
+ // for sanity's sake, let's log url and user ... just to make sure we are reading the data
+ logger.info("jdbc.url=" + env.getProperty("jdbc.url"));
+ logger.info("jdbc.user=" + env.getProperty("jdbc.user"));
+
+ // set database connection props
+ myDataSource.setJdbcUrl(env.getProperty("jdbc.url"));
+ myDataSource.setUser(env.getProperty("jdbc.user"));
+ myDataSource.setPassword(env.getProperty("jdbc.password"));
+
+ // set connection pool props
+ myDataSource.setInitialPoolSize(getIntProperty("connection.pool.initialPoolSize"));
+ myDataSource.setMinPoolSize(getIntProperty("connection.pool.minPoolSize"));
+ myDataSource.setMaxPoolSize(getIntProperty("connection.pool.maxPoolSize"));
+ myDataSource.setMaxIdleTime(getIntProperty("connection.pool.maxIdleTime"));
+
+ return myDataSource;
+ }
+
+
+ @Override
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ registry.addResourceHandler("/js/**").addResourceLocations("classpath:/js/");
+ registry.addResourceHandler("/css/**").addResourceLocations("classpath:/css/");
+ registry.addResourceHandler("/images/**").addResourceLocations("classpath:/images/");
+ }
+
+
+ private Properties getHibernateProperties() {
+
+ // set hibernate properties
+ Properties props = new Properties();
+
+ props.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
+ props.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql"));
+
+ return props;
+ }
+
+
+ // need a helper method
+ // read environment property and convert to int
+
+ private int getIntProperty(String propName) {
+
+ String propVal = env.getProperty(propName);
+
+ // now convert to int
+ int intPropVal = Integer.parseInt(propVal);
+
+ return intPropVal;
+ }
+
+ @Bean
+ public LocalSessionFactoryBean sessionFactory(){
+
+ // create session factorys
+ LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
+
+ // set the properties
+ sessionFactory.setDataSource(myDataSource());
+ sessionFactory.setPackagesToScan(env.getProperty("hibernate.packagesToScan"));
+ sessionFactory.setHibernateProperties(getHibernateProperties());
+
+ return sessionFactory;
+ }
+
+ @Bean
+ @Autowired
+ public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
+
+ // setup transaction manager based on session factory
+ HibernateTransactionManager txManager = new HibernateTransactionManager();
+ txManager.setSessionFactory(sessionFactory);
+
+ return txManager;
+ }
+
+
+}
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/webapp/config/DemoSecurityConfig.java b/src/main/java/com/webapp/config/DemoSecurityConfig.java
new file mode 100644
index 0000000..20e5abb
--- /dev/null
+++ b/src/main/java/com/webapp/config/DemoSecurityConfig.java
@@ -0,0 +1,48 @@
+package com.webapp.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.core.userdetails.User.UserBuilder;
+
+@Configuration
+@EnableWebSecurity
+public class DemoSecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Override
+ protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+
+ // add our users for in memory authentication
+
+ UserBuilder users = User.withDefaultPasswordEncoder();
+
+ auth.inMemoryAuthentication()
+ .withUser(users.username("john").password("test123").roles("EMPLOYEE"))
+ .withUser(users.username("mary").password("test123").roles("MANAGER"))
+ .withUser(users.username("susan").password("test123").roles("ADMIN"));
+ }
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+
+ http.authorizeRequests()
+ .antMatchers("/css/**","/images/**").permitAll()
+ .anyRequest().authenticated()
+ .and()
+ .formLogin()
+ .loginPage("/Login")
+ .loginProcessingUrl("/authenticateTheUser")
+ .permitAll();
+
+ }
+
+}
+
+
+
+
+
+
diff --git a/src/main/java/com/webapp/config/MySpringMvcDispatcherServletInitializer.java b/src/main/java/com/webapp/config/MySpringMvcDispatcherServletInitializer.java
new file mode 100644
index 0000000..46dbc84
--- /dev/null
+++ b/src/main/java/com/webapp/config/MySpringMvcDispatcherServletInitializer.java
@@ -0,0 +1,29 @@
+package com.webapp.config;
+
+import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
+
+public class MySpringMvcDispatcherServletInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
+
+ @Override
+ protected Class>[] getRootConfigClasses() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected Class>[] getServletConfigClasses() {
+ return new Class[] { DemoAppConfig.class };
+ }
+
+ @Override
+ protected String[] getServletMappings() {
+ return new String[] { "/" };
+ }
+
+}
+
+
+
+
+
+
diff --git a/src/main/java/com/webapp/config/SecurityWebApplicationInitializer.java b/src/main/java/com/webapp/config/SecurityWebApplicationInitializer.java
new file mode 100644
index 0000000..d28dc08
--- /dev/null
+++ b/src/main/java/com/webapp/config/SecurityWebApplicationInitializer.java
@@ -0,0 +1,8 @@
+package com.webapp.config;
+
+import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
+
+public class SecurityWebApplicationInitializer
+ extends AbstractSecurityWebApplicationInitializer {
+
+}
diff --git a/src/main/java/com/webapp/controller/AppRestController.java b/src/main/java/com/webapp/controller/AppRestController.java
new file mode 100644
index 0000000..fff93eb
--- /dev/null
+++ b/src/main/java/com/webapp/controller/AppRestController.java
@@ -0,0 +1,91 @@
+package com.webapp.controller;
+
+import java.util.List;
+
+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.RestController;
+
+import com.webapp.enity.*;
+import com.webapp.services.*;
+
+
+
+@RestController
+@RequestMapping("/Api")
+public class AppRestController {
+
+ @Autowired
+ private BattriesService battriesService;
+
+ @Autowired
+ private RimesServices rimesService;
+
+ @Autowired
+ private BudgetService budgetService;
+
+
+ @Autowired
+ private SallesService sallesService;
+
+ @Autowired
+ private SupplierService supplierService;
+
+ @Autowired
+ private TiresService tiresService;
+
+ @Autowired
+ private UserService userService;
+
+ @GetMapping("/Salle")
+ public List getSalles()
+ {
+ return sallesService.getAllSalles();
+ }
+
+ @GetMapping("/Rimes")
+ public List getRimes()
+ {
+ return rimesService.getRimes();
+ }
+ @GetMapping("/Tires")
+ public List getTires()
+ {
+ return tiresService.getAllTires();
+ }
+ @GetMapping("/Battries")
+ public List getBattries()
+ {
+ return battriesService.getAllBattries();
+ }
+
+ @GetMapping("/Budget")
+ public List getBudget()
+ {
+ return budgetService.getAllBudget();
+ }
+ @GetMapping("/User")
+ public List getUser()
+ {
+ return userService.getAllUsers();
+ }
+
+
+ @GetMapping("/Supplier")//erro
+ public List getSupplier()
+ {
+ return supplierService.getAllSuppliers();
+ }
+
+ @GetMapping("/CardInfo")//erro
+ public List getCardInfo()
+ {
+ return tiresService.getAllTires();
+ }
+
+
+
+
+
+}
diff --git a/src/main/java/com/webapp/controller/BattryController.java b/src/main/java/com/webapp/controller/BattryController.java
new file mode 100644
index 0000000..b16e984
--- /dev/null
+++ b/src/main/java/com/webapp/controller/BattryController.java
@@ -0,0 +1,102 @@
+package com.webapp.controller;
+
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.support.PagedListHolder;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.webapp.enity.Battries;
+import com.webapp.enity.ItemList;
+import com.webapp.services.BattriesService;
+
+
+
+@Controller
+public class BattryController {
+
+ @Autowired
+ private BattriesService battryService;
+
+
+ @RequestMapping("/Battries")
+ public ModelAndView listBattry(@RequestParam(required = false) Integer page , Model model) {
+
+ ModelAndView modelAndView = new ModelAndView("battry/battries");
+ List theBattries = battryService.getAllBattries();
+ model.addAttribute("theBattries",theBattries);
+
+ PagedListHolder pagedListHolder = new PagedListHolder<>(theBattries);
+ pagedListHolder.setPageSize(10);
+ modelAndView.addObject("maxPages", pagedListHolder.getPageCount());
+
+ if(page==null || page < 1 || page > pagedListHolder.getPageCount())page=1;
+
+ modelAndView.addObject("page", page);
+ if(page == null || page < 1 || page > pagedListHolder.getPageCount()){
+ pagedListHolder.setPage(0);
+ modelAndView.addObject("battry", pagedListHolder.getPageList());
+ }
+ else if(page <= pagedListHolder.getPageCount()) {
+ pagedListHolder.setPage(page-1);
+ modelAndView.addObject("battry", pagedListHolder.getPageList());
+ }
+
+ return modelAndView;
+ }
+
+ @GetMapping("/Add-Battry")
+ public String AddBattry(Model theModel) {
+
+ Battries theBattry=new Battries();
+
+ theModel.addAttribute("battry",theBattry);
+
+ return "battry/Add-Battry";
+ }
+
+
+ @PostMapping("/Save-Battry")
+ public String saveBattry(@ModelAttribute("theBattry") Battries theBattry)
+ {
+ battryService.saveBattry(theBattry);
+ return "redirect:/Battries";
+ }
+
+ /// Update Customer Form
+ @GetMapping("/Update-Battry")
+ public String UpdateBattry(@RequestParam ("battryId") int theId ,Model theModel) {
+
+ //get customer from services
+ Battries theBattries =battryService.getBattry(theId);
+ //set customer as model attibute to form
+ theModel.addAttribute("battry", theBattries);
+ //send over to our form
+
+ return "battry/Add-Battry";
+ }
+
+ @GetMapping("/Delete-Battry")
+ public String deleteBattry(@RequestParam ("battryId") int theId ,Model theModel) {
+
+ //delete customer from services
+ battryService.deleteBattries(theId);
+
+ return "redirect:/Battries";
+ }
+
+ @ModelAttribute("CountryList")
+ public List getCountryList(){
+ ItemList list=new ItemList();
+ List countryLists = list.getCountryList();
+ return countryLists;
+ }
+}
diff --git a/src/main/java/com/webapp/controller/BudgetController.java b/src/main/java/com/webapp/controller/BudgetController.java
new file mode 100644
index 0000000..6f7577c
--- /dev/null
+++ b/src/main/java/com/webapp/controller/BudgetController.java
@@ -0,0 +1 @@
+package com.webapp.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.support.PagedListHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import com.webapp.enity.Budget;
import com.webapp.services.BudgetService;
import com.webapp.utils.CustomDate;
@Controller
public class BudgetController {
@Autowired
private BudgetService budgetService;
long totalIncome = 0;
long totalExpenses = 0;
long total = 0;
long IncomeYearly;
long ExpensesYearly;
long totalYearly;
@RequestMapping("/Budget-Table")
public ModelAndView listBudget(@RequestParam(required = false) Integer page, Model theModel) {
/*
*
* CustomDate date=new CustomDate();
* theModel.addAttribute("year",date.getThisYear());
*
* totalYearly=calculateYearlyBudget(theBudget);
* theModel.addAttribute("IncomeYearly",IncomeYearly);
* theModel.addAttribute("ExpensesYearly",ExpensesYearly);
* theModel.addAttribute("totalYearly",totalYearly);
*
* return "budget/budget-table";
*/
ModelAndView modelAndView = new ModelAndView("budget/budget-table");
List theBudget = budgetService.getAllBudget();
theModel.addAttribute("theBudget", theBudget);
CustomDate date = new CustomDate();
theModel.addAttribute("year", date.getThisYear());
totalYearly = calculateYearlyBudget(theBudget);
theModel.addAttribute("IncomeYearly", IncomeYearly);
theModel.addAttribute("ExpensesYearly", ExpensesYearly);
theModel.addAttribute("totalYearly", totalYearly);
PagedListHolder pagedListHolder = new PagedListHolder<>(theBudget);
pagedListHolder.setPageSize(10);
modelAndView.addObject("maxPages", pagedListHolder.getPageCount());
if (page == null || page < 1 || page > pagedListHolder.getPageCount())
page = 1;
modelAndView.addObject("page", page);
if (page == null || page < 1 || page > pagedListHolder.getPageCount()) {
pagedListHolder.setPage(0);
modelAndView.addObject("budgets", pagedListHolder.getPageList());
} else if (page <= pagedListHolder.getPageCount()) {
pagedListHolder.setPage(page - 1);
modelAndView.addObject("budgets", pagedListHolder.getPageList());
}
return modelAndView;
}
@GetMapping("/Budget")
public String AddBudget(Model theModel) {
/// create model attribute to bind form data
CustomDate date = new CustomDate();
Budget theBudget = new Budget();
List theIncomeList = budgetService.getIncomeThisMonth();
List theExpensesList = budgetService.getExpencesThisMonth();
totalIncome = culculateTotals(theIncomeList);
totalExpenses = culculateTotals(theExpensesList);
total = totalIncome - totalExpenses;
theModel.addAttribute("totalIncome", totalIncome);
theModel.addAttribute("totalExpenses", totalExpenses);
theModel.addAttribute("total", total);
theModel.addAttribute("month", date.CurrentMonthName());
theModel.addAttribute("budget", theBudget);
theModel.addAttribute("theIncome", theIncomeList);
theModel.addAttribute("theExpenses", theExpensesList);
theModel.addAttribute("lastMonth", date.LastMonthName());
//// System.out.println("date.LastMonthName() "+date.LastMonthName());
long IncomeLastMonth = budgetService.totalIncomeLastMonth();
long ExpensesLastMonth = budgetService.totalExpencesLastMonth();
theModel.addAttribute("totalIncomeLastMonth", IncomeLastMonth);
theModel.addAttribute("totalExpensesLastMonth", ExpensesLastMonth);
budgetService.getExpencesThisMonth();
return "budget/budget";
}
@PostMapping("/Save-Budget")
public String saveBudget(@ModelAttribute("budget") Budget theBudget) {
budgetService.saveBudget(theBudget);
return "redirect:/Budget";
}
/// Update Customer Form
@GetMapping("/Update-Budget")
public String UpdateBudget(@RequestParam("budgetId") int theId, Model theModel) {
// get customer from services
Budget theBudget = budgetService.getBudget(theId);
// set customer as model attibute to form
theModel.addAttribute("budget", theBudget);
// send over to our form
return "redirect:/budget";
}
@GetMapping("/Delete-Budget")
public String deleteBudget(@RequestParam("budgetId") int theId, Model theModel) {
// delete customer from services
budgetService.deleteBudget(theId);
return "redirect:/Budget-Table";
}
public long culculateTotals(List budgetData) {
int sum = 0;
for (Budget budget : budgetData) {
sum += budget.getValue();
}
return sum;
}
public long calculateYearlyBudget(List budgetData) {
IncomeYearly = 0;
ExpensesYearly = 0;
totalYearly = 0;
for (Budget budget : budgetData) {
if (budget.getType().equals("Income")) {
IncomeYearly += budget.getValue();
} else {
ExpensesYearly += budget.getValue();
}
}
return IncomeYearly - ExpensesYearly;
}
}
\ No newline at end of file
diff --git a/src/main/java/com/webapp/controller/LoginController.java b/src/main/java/com/webapp/controller/LoginController.java
new file mode 100644
index 0000000..d0cd783
--- /dev/null
+++ b/src/main/java/com/webapp/controller/LoginController.java
@@ -0,0 +1,17 @@
+package com.webapp.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+
+@Controller
+public class LoginController {
+
+ @GetMapping("/Login")
+ public String showMyLoginPage() {
+
+ // return "plain-login";
+
+ return "login";
+
+ }
+}
diff --git a/src/main/java/com/webapp/controller/NavController.java b/src/main/java/com/webapp/controller/NavController.java
new file mode 100644
index 0000000..13c70df
--- /dev/null
+++ b/src/main/java/com/webapp/controller/NavController.java
@@ -0,0 +1,49 @@
+package com.webapp.controller;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+
+import com.webapp.enity.Battries;
+import com.webapp.enity.Tires;
+import com.webapp.services.BattriesService;
+import com.webapp.services.TiresService;
+
+
+@Controller
+public class NavController {
+
+
+ @Autowired
+ private BattriesService battriesService;
+
+ @Autowired
+ private TiresService tiresService;
+
+ public String EditProduct(int id,int Quantity ,String Type)
+ {
+ if(Type=="Tires")
+ {
+ Tires tire=tiresService.getTires(id);
+ int x=tire.getQuatity()-Quantity;
+ tire.setQuatity(x);
+ tiresService.saveTires(tire);
+ System.out.println(tire);
+
+ }
+ else
+ {
+ Battries battry=battriesService.getBattry(id);
+ int y=battry.getQuatity()-Quantity;
+ battry.setQuatity(y);
+ battriesService.saveBattry(battry);
+ System.out.println(battry);
+ }
+ return "redirect:/Salles";
+ }
+ /*@GetMapping("/")
+ public String home() {
+
+ return "index";
+ }*/
+
+}
diff --git a/src/main/java/com/webapp/controller/RimesController.java b/src/main/java/com/webapp/controller/RimesController.java
new file mode 100644
index 0000000..d14717a
--- /dev/null
+++ b/src/main/java/com/webapp/controller/RimesController.java
@@ -0,0 +1,100 @@
+package com.webapp.controller;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.support.PagedListHolder;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.webapp.enity.ItemList;
+import com.webapp.enity.Rimes;
+import com.webapp.services.RimesServices;
+
+@Controller
+public class RimesController {
+
+ @Autowired
+ private RimesServices rimesService;
+
+ @RequestMapping("/Rimes")
+ public ModelAndView listBattry(@RequestParam(required = false) Integer page ,Model model) {
+
+ ModelAndView modelAndView = new ModelAndView("rimes/Rimes");
+ List theRimes = rimesService.getRimes();
+
+ model.addAttribute("theRimes",theRimes);
+
+ PagedListHolder pagedListHolder = new PagedListHolder<>(theRimes);
+ pagedListHolder.setPageSize(10);
+ modelAndView.addObject("maxPages", pagedListHolder.getPageCount());
+
+ if(page==null || page < 1 || page > pagedListHolder.getPageCount())page=1;
+
+ modelAndView.addObject("page", page);
+ if(page == null || page < 1 || page > pagedListHolder.getPageCount()){
+ pagedListHolder.setPage(0);
+ modelAndView.addObject("rimes", pagedListHolder.getPageList());
+ }
+ else if(page <= pagedListHolder.getPageCount()) {
+ pagedListHolder.setPage(page-1);
+ modelAndView.addObject("rimes", pagedListHolder.getPageList());
+ }
+
+ return modelAndView;
+ }
+
+ @GetMapping("/Add-Rimes")
+ public String AddBattry(Model theModel) {
+
+ Rimes theRimes=new Rimes();
+
+ theModel.addAttribute("Rimes",theRimes);
+
+ return "rimes/Add-Rimes";
+ }
+
+
+ @PostMapping("/Save-Rimes")
+ public String saveBattry(@ModelAttribute("theRimes") Rimes theRimes)
+ {
+ rimesService.saveRimes(theRimes);
+ return "redirect:/Rimes";
+ }
+
+ /// Update Customer Form
+ @GetMapping("/Update-Rimes")
+ public String UpdateBattry(@RequestParam ("rimesId") int theId ,Model theModel) {
+
+ //get customer from services
+ Rimes theRimes =rimesService.getRimes(theId);
+ //set customer as model attibute to form
+ theModel.addAttribute("rimes", theRimes);
+ //send over to our form
+
+ return "rimes/Add-Rimes";
+ }
+
+ @GetMapping("/Delete-Rimes")
+ public String deleteBattry(@RequestParam ("rimesId") int theId ,Model theModel) {
+
+ //delete customer from services
+ rimesService.deleteRimes(theId);
+
+ return "redirect:/Rimes";
+ }
+
+ @ModelAttribute("CountryList")
+ public List getCountryList(){
+ ItemList list=new ItemList();
+ List countryLists = list.getCountryList();
+ return countryLists;
+ }
+
+}
diff --git a/src/main/java/com/webapp/controller/SallesController.java b/src/main/java/com/webapp/controller/SallesController.java
new file mode 100644
index 0000000..07f2628
--- /dev/null
+++ b/src/main/java/com/webapp/controller/SallesController.java
@@ -0,0 +1,151 @@
+package com.webapp.controller;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.support.PagedListHolder;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.webapp.enity.Battries;
+import com.webapp.enity.Rimes;
+import com.webapp.enity.Salles;
+import com.webapp.enity.Tires;
+import com.webapp.services.BattriesService;
+import com.webapp.services.RimesServices;
+import com.webapp.services.SallesService;
+import com.webapp.services.TiresService;
+import com.webapp.utils.CustomDate;
+
+
+
+@Controller
+public class SallesController {
+
+
+ @Autowired
+ private SallesService sallesService;
+
+ @Autowired
+ private BattriesService battriesService;
+
+ @Autowired
+ private TiresService tiresService;
+
+ @Autowired
+ private RimesServices rimesService;
+
+ @RequestMapping("/Sales")
+ public String Salles(Model theModel) {
+ CustomDate d = new CustomDate();
+ Salles salles=new Salles();
+
+ theModel.addAttribute("sales", salles);
+
+ theModel.addAttribute("thisMonthName", d.CurrentMonthName());
+
+ theModel.addAttribute("totalThisMonth", sallesService.totalThisMonth());
+ theModel.addAttribute("totalTire", sallesService.totalThisMonthByType("tire"));
+ theModel.addAttribute("totalBattry", sallesService.totalThisMonthByType("battry"));
+ theModel.addAttribute("totalRimes", sallesService.totalThisMonthByType("rimes"));
+
+ theModel.addAttribute("salesThisMonth", sallesService.SallesThisMonth());
+ System.out.println(sallesService.SallesThisMonth().toString());
+ ////theModel.addAttribute("salles", theSalles);
+
+ return "sales/salles";
+ }
+ @RequestMapping(value = "/export-sales", method = RequestMethod.GET)
+ public ModelAndView getExcel() {
+ List theSales = sallesService.getAllSalles();
+ return new ModelAndView("SalesListExcel", "theSales", theSales);
+ }
+
+ @RequestMapping("/Sales-list")
+ public ModelAndView listSalles(@RequestParam(required = false) Integer page , Model theModel) {
+ ModelAndView modelAndView = new ModelAndView("sales/salles-list");
+
+ List theSales = sallesService.getAllSalles();
+ System.out.println(theSales.size());
+ theModel.addAttribute("theSales",theSales);
+
+ PagedListHolder pagedListHolder = new PagedListHolder<>(theSales);
+ pagedListHolder.setPageSize(10);
+ modelAndView.addObject("maxPages", pagedListHolder.getPageCount());
+
+ if(page==null || page < 1 || page > pagedListHolder.getPageCount())page=1;
+
+ modelAndView.addObject("page", page);
+ if(page == null || page < 1 || page > pagedListHolder.getPageCount()){
+ pagedListHolder.setPage(0);
+ modelAndView.addObject("sales", pagedListHolder.getPageList());
+ }
+ else if(page <= pagedListHolder.getPageCount()) {
+ pagedListHolder.setPage(page-1);
+ modelAndView.addObject("sales", pagedListHolder.getPageList());
+ }
+ return modelAndView;
+ }
+
+ @GetMapping("/Add-Sales")
+ public String AddSalles(Model theModel) {
+
+ Salles theSalles=new Salles();
+
+ theModel.addAttribute("sales",theSalles);
+
+ return "sales/Add-Salles";
+ }
+
+
+ @PostMapping("/Save-Sales")
+ public String saveSalles(@ModelAttribute("salles") Salles theSalles)
+ {
+ sallesService.saveSalles(theSalles);
+
+ String type=theSalles.getType();
+ if(type.equals("Tire"))
+ {
+ Tires tire=tiresService.getTires(theSalles.getProductId());
+ int x=tire.getQuatity()-theSalles.getQuantity();
+ tire.setQuatity(x);
+ tiresService.saveTires(tire);
+
+ }
+ else if(type.equals("Rimes"))
+ {
+ Rimes rimes=rimesService.getRimes(theSalles.getProductId());
+ int r=rimes.getQuatity() - theSalles.getQuantity();
+ rimes.setQuatity(r);
+ rimesService.saveRimes(rimes);
+
+ }
+ else if(type.equals("Battry"))
+ {
+ Battries battry=battriesService.getBattry(theSalles.getProductId());
+ int y=battry.getQuatity()-theSalles.getQuantity();
+ battry.setQuatity(y);
+ battriesService.saveBattry(battry);
+ System.out.println(battry.toString());
+ }
+ return "redirect:/Sales";
+ }
+
+ @GetMapping("/Delete-Sales")
+ public String deletSalles(@RequestParam ("sallesId") int theId ,Model theModel) {
+
+
+ sallesService.deleteSalles(theId);
+
+ return "redirect:/sales/Salles";
+ }
+
+
+}
diff --git a/src/main/java/com/webapp/controller/SupplierController.java b/src/main/java/com/webapp/controller/SupplierController.java
new file mode 100644
index 0000000..66aec87
--- /dev/null
+++ b/src/main/java/com/webapp/controller/SupplierController.java
@@ -0,0 +1,94 @@
+package com.webapp.controller;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.support.PagedListHolder;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.webapp.enity.Supplier;
+import com.webapp.services.SupplierService;
+
+
+
+@Controller
+public class SupplierController {
+
+ @Autowired
+ private SupplierService supplierService;
+
+
+ @RequestMapping("/Supplier")
+ public ModelAndView listSupplier(@RequestParam(required = false) Integer page , Model theModel) {
+
+
+ List theSupplier = supplierService.getAllSuppliers();
+ ModelAndView modelAndView = new ModelAndView("supplier/supplier");
+
+ theModel.addAttribute("theSupplier",theSupplier);
+
+ PagedListHolder pagedListHolder = new PagedListHolder<>(theSupplier);
+ pagedListHolder.setPageSize(10);
+ modelAndView.addObject("maxPages", pagedListHolder.getPageCount());
+
+ if(page==null || page < 1 || page > pagedListHolder.getPageCount())page=1;
+
+ modelAndView.addObject("page", page);
+ if(page == null || page < 1 || page > pagedListHolder.getPageCount()){
+ pagedListHolder.setPage(0);
+ modelAndView.addObject("supplier", pagedListHolder.getPageList());
+ }
+ else if(page <= pagedListHolder.getPageCount()) {
+ pagedListHolder.setPage(page-1);
+ modelAndView.addObject("supplier", pagedListHolder.getPageList());
+ }
+
+ return modelAndView;
+ }
+
+ @GetMapping("/Add-Supplier")
+ public String AddSupplier(Model theModel) {
+
+ ///create model attribute to bind form data
+ Supplier theSupplier=new Supplier();
+
+ theModel.addAttribute("supplier",theSupplier);
+
+ return "supplier/Add-Supplier";
+ }
+ @PostMapping("/Save-Supplier")
+ public String saveSupplier(@ModelAttribute("theSupplier") Supplier theSupplier)
+ {
+ supplierService.saveSuppliers(theSupplier);
+ return "redirect:/Supplier";
+ }
+
+ /// Update Customer Form
+ @GetMapping("/Update-Supplier")
+ public String UpdateSupplier(@RequestParam ("supplierId") int theId ,Model theModel) {
+
+ //get customer from services
+ Supplier theSupplier =supplierService.getSuppliers(theId);
+ //set customer as model attibute to form
+ theModel.addAttribute("supplier", theSupplier);
+ //send over to our form
+
+ return "supplier/Add-Supplier";
+ }
+
+ @GetMapping("/Delete-Supplier")
+ public String deleteSupplier(@RequestParam ("supplierId") int theId ,Model theModel) {
+
+ //delete customer from services
+ supplierService.deleteSuppliers(theId);
+
+ return "redirect:/Supplier";
+ }
+}
diff --git a/src/main/java/com/webapp/controller/SupplyingController.java b/src/main/java/com/webapp/controller/SupplyingController.java
new file mode 100644
index 0000000..37e4b2d
--- /dev/null
+++ b/src/main/java/com/webapp/controller/SupplyingController.java
@@ -0,0 +1,165 @@
+package com.webapp.controller;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.support.PagedListHolder;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.webapp.enity.Battries;
+import com.webapp.enity.Rimes;
+import com.webapp.enity.Supplying;
+import com.webapp.enity.Tires;
+import com.webapp.services.BattriesService;
+import com.webapp.services.RimesServices;
+import com.webapp.services.SupplyingService;
+import com.webapp.services.TiresService;
+import com.webapp.utils.CustomDate;
+
+@Controller
+public class SupplyingController {
+
+ @Autowired
+ private SupplyingService supplyService;
+
+ @Autowired
+ private BattriesService battriesService;
+
+ @Autowired
+ private TiresService tiresService;
+
+ @Autowired
+ private RimesServices rimesService;
+
+ @RequestMapping("/Supplying")
+ public String Supplying(Model theModel,HttpServletRequest request) {
+
+ CustomDate d = new CustomDate();
+ Supplying supplying=new Supplying();
+
+ theModel.addAttribute("supplying", supplying);
+
+ theModel.addAttribute("thisMonthName", d.CurrentMonthName());
+
+ theModel.addAttribute("totalThisMonth", supplyService.totalThisMonth());
+ theModel.addAttribute("totalTire", supplyService.totalThisMonthByType("tire"));
+ theModel.addAttribute("totalBattry", supplyService.totalThisMonthByType("battry"));
+ theModel.addAttribute("totalRimes", supplyService.totalThisMonthByType("rimes"));
+
+ theModel.addAttribute("supplyingThisMonth", supplyService.SupplyingThisMonth());
+
+ return "supplying/supplying";
+ }
+ @RequestMapping("/Supplying-list")
+ public ModelAndView listSalles(@RequestParam(required = false) Integer page , Model theModel) {
+ ModelAndView modelAndView = new ModelAndView("supplying/supplying-list");
+
+ List theSupplying = supplyService.getAllSupplying();
+
+ theModel.addAttribute("theSupplying",theSupplying);
+
+ PagedListHolder pagedListHolder = new PagedListHolder<>(theSupplying);
+ pagedListHolder.setPageSize(10);
+ modelAndView.addObject("maxPages", pagedListHolder.getPageCount());
+
+ if(page==null || page < 1 || page > pagedListHolder.getPageCount())page=1;
+
+ modelAndView.addObject("page", page);
+ if(page == null || page < 1 || page > pagedListHolder.getPageCount()){
+ pagedListHolder.setPage(0);
+ modelAndView.addObject("supplying", pagedListHolder.getPageList());
+ }
+ else if(page <= pagedListHolder.getPageCount()) {
+ pagedListHolder.setPage(page-1);
+ modelAndView.addObject("supplying", pagedListHolder.getPageList());
+ }
+
+ return modelAndView;
+ }
+ @PostMapping("/Save-Supplying")
+ public String saveSalles(@ModelAttribute("supplying") Supplying theSupplying)
+ {
+ theSupplying.toString();
+
+ String type=theSupplying.getType();
+ if(type.equals("Tire"))
+ {
+ Tires tire=tiresService.getTires(theSupplying.getProductId());
+ theSupplying.setProductId(tire.getId());
+ theSupplying.setQuantity_Before(tire.getQuatity());
+ int x=tire.getQuatity()+theSupplying.getQuantity();
+ tire.setQuatity(x);
+ tiresService.saveTires(tire);
+
+
+ }
+ else if(type.equals("Rimes"))
+ {
+ Rimes rimes=rimesService.getRimes(theSupplying.getProductId());
+ theSupplying.setProductId(rimes.getId());
+ theSupplying.setQuantity_Before(rimes.getQuatity());
+ int r=rimes.getQuatity() + theSupplying.getQuantity();
+ rimes.setQuatity(r);
+ rimesService.saveRimes(rimes);
+
+ }
+ else if(type.equals("Battry"))
+ {
+ Battries battry=battriesService.getBattry(theSupplying.getProductId());
+
+ theSupplying.setProductId(battry.getId());
+ theSupplying.setQuantity_Before(battry.getQuatity());
+
+ int y=battry.getQuatity()+theSupplying.getQuantity();
+ battry.setQuatity(y);
+ battriesService.saveBattry(battry);
+ }
+
+ supplyService.saveSupplying(theSupplying);
+
+ return "redirect:/Supplying";
+ }
+
+ @GetMapping("/Delete-Supplying")
+ public String deletSalles(@RequestParam ("supplyingId") int theId ,Model theModel) {
+
+ Supplying theSupplying=supplyService.getSupplying(theId);
+
+ supplyService.deleteSupplying(theId);
+ String type=theSupplying.getType();
+ if(type.equals("Tire"))
+ {
+ Tires tire=tiresService.getTires(theSupplying.getProductId());
+ int x=tire.getQuatity()-theSupplying.getQuantity();
+ tire.setQuatity(x);
+ tiresService.saveTires(tire);
+
+ }
+ else if(type.equals("Rimes"))
+ {
+ Rimes rimes=rimesService.getRimes(theSupplying.getProductId());
+ int r=rimes.getQuatity() - theSupplying.getQuantity();
+ rimes.setQuatity(r);
+ rimesService.saveRimes(rimes);
+
+ }
+ else if(type.equals("Battry"))
+ {
+ Battries battry=battriesService.getBattry(theSupplying.getProductId());
+ int y=battry.getQuatity()-theSupplying.getQuantity();
+ battry.setQuatity(y);
+ battriesService.saveBattry(battry);
+ System.out.println(battry.toString());
+ }
+ return "redirect:/Supplying";
+ }
+}
diff --git a/src/main/java/com/webapp/controller/TiresController.java b/src/main/java/com/webapp/controller/TiresController.java
new file mode 100644
index 0000000..8dc6b68
--- /dev/null
+++ b/src/main/java/com/webapp/controller/TiresController.java
@@ -0,0 +1,86 @@
+package com.webapp.controller;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.support.PagedListHolder;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.webapp.enity.ItemList;
+import com.webapp.enity.Tires;
+import com.webapp.services.TiresService;
+
+@Controller
+public class TiresController {
+
+ @Autowired
+ private TiresService tiresService;
+
+ @RequestMapping("/Tires")
+ public ModelAndView listTires(@RequestParam(required = false) Integer page, Model theModel) {
+
+ ModelAndView modelAndView = new ModelAndView("tire/Tires");
+ List theTires = tiresService.getAllTires();
+
+ theModel.addAttribute("theTires", theTires);
+
+ PagedListHolder pagedListHolder = new PagedListHolder<>(theTires);
+ pagedListHolder.setPageSize(10);
+ modelAndView.addObject("maxPages", pagedListHolder.getPageCount());
+
+ if (page == null || page < 1 || page > pagedListHolder.getPageCount())
+ page = 1;
+
+ modelAndView.addObject("page", page);
+ if (page == null || page < 1 || page > pagedListHolder.getPageCount()) {
+ pagedListHolder.setPage(0);
+ modelAndView.addObject("tire", pagedListHolder.getPageList());
+ } else if (page <= pagedListHolder.getPageCount()) {
+ pagedListHolder.setPage(page - 1);
+ modelAndView.addObject("tire", pagedListHolder.getPageList());
+ }
+
+ return modelAndView;
+ }
+
+ @GetMapping("/Add-Tires")
+ public String AddTires(Model theModel) {
+
+ /// create model attribute to bind form data
+ Tires theTires = new Tires();
+
+ theModel.addAttribute("tires", theTires);
+
+ return "tire/Add-Tires";
+ }
+
+ @PostMapping("/Save-Tires")
+ public String saveTires(@ModelAttribute("tires") Tires theTires) {
+
+ tiresService.saveTires(theTires);
+ return "redirect:/Tires";
+ }
+
+ @GetMapping("/Delete-Tires")
+ public String deleteTires(@RequestParam("tiresId") int theId, Model theModel) {
+
+ // delete customer from services
+ tiresService.deleteTires(theId);
+
+ return "redirect:/Tires";
+ }
+
+ @ModelAttribute("CountryList")
+ public List getCountryList() {
+ ItemList list = new ItemList();
+ List countryLists = list.getCountryList();
+ return countryLists;
+ }
+}
diff --git a/src/main/java/com/webapp/controller/UserController.java b/src/main/java/com/webapp/controller/UserController.java
new file mode 100644
index 0000000..d37a01b
--- /dev/null
+++ b/src/main/java/com/webapp/controller/UserController.java
@@ -0,0 +1,74 @@
+package com.webapp.controller;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import com.webapp.enity.User;
+import com.webapp.services.UserService;
+
+
+@Controller
+public class UserController {
+
+
+ @Autowired
+ private UserService userService;
+
+
+ @RequestMapping("/Users")
+ public String listUsers(Model theModel) {
+
+
+ List theUser = userService.getAllUsers();
+
+ theModel.addAttribute("user", theUser);
+
+ return "user/users";
+ }
+
+ @GetMapping("/Add-Users")
+ public String AddUser(Model theModel) {
+
+ ///create model attribute to bind form data
+ User theUser=new User();
+
+ theModel.addAttribute("user",theUser);
+
+ return "user/Add-User";
+ }
+ @PostMapping("/Save-User")
+ public String saveUsers(@ModelAttribute("user") User theUser)
+ {
+ userService.saveUsers(theUser);
+ return "redirect:/Add-User";
+ }
+
+ /// Update Customer Form
+ @GetMapping("/Update-User")
+ public String UpdateUser(@RequestParam ("userId") int theId ,Model theModel) {
+
+ //get customer from services
+ User theUser =userService.getUser(theId);
+ theModel.addAttribute("user", theUser);
+ //send over to our form
+
+ return "Add-User";
+ }
+
+ @GetMapping("/Delete-User")
+ public String deleteUser(@RequestParam ("userId") int theId ,Model theModel) {
+
+ //delete customer from services
+ userService.deleteUsers(theId);
+
+ return "redirect:/User";
+ }
+}
diff --git a/src/main/java/com/webapp/controller/homeController.java b/src/main/java/com/webapp/controller/homeController.java
new file mode 100644
index 0000000..56c540a
--- /dev/null
+++ b/src/main/java/com/webapp/controller/homeController.java
@@ -0,0 +1,64 @@
+package com.webapp.controller;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import com.webapp.enity.*;
+import com.webapp.services.*;
+
+@Controller
+public class homeController {
+
+ @Autowired
+ private BattriesService battryService;
+
+ @Autowired
+ private TiresService tireService;
+
+ @Autowired
+ private SallesService sallesService;
+
+ @Autowired
+ private RimesServices rimesService;
+
+ @Autowired
+ private BudgetService budgetService;
+
+ @RequestMapping(value = "/", method = RequestMethod.GET)
+ public String home(Model theModel) {
+
+ theModel.addAttribute("tireQuantity", tireService.TotalLength());
+ theModel.addAttribute("tirePrice", tireService.TotalPrice());
+
+ theModel.addAttribute("battaryQuantity", battryService.TotalLength());
+ theModel.addAttribute("battaryPrice", battryService.TotalPrice());
+
+ theModel.addAttribute("rimesQuantity", rimesService.TotalLength());
+ theModel.addAttribute("rimesPrice", rimesService.TotalPrice());
+
+ theModel.addAttribute("sallesLastMonth", sallesService.totalLastMonth());
+ theModel.addAttribute("sallesThisMonth", sallesService.totalThisMonth());
+
+ theModel.addAttribute("budget", budgetService.totalIncomeThisMonth() - budgetService.totalExpencesThisMonth());
+ theModel.addAttribute("budgetLastMonth",
+ budgetService.totalIncomeLastMonth() - budgetService.totalExpencesLastMonth());
+
+ theModel.addAttribute("topSallesProduct", sallesService.top5SallesItem());
+ theModel.addAttribute("top15Tires", tireService.top15Item());
+ theModel.addAttribute("top15Battry", battryService.top15Item());
+ theModel.addAttribute("top15Rimes", rimesService.top15Item());
+
+ theModel.addAttribute("topRefillTires", tireService.refillTire());
+ theModel.addAttribute("topRefillBattry", battryService.refillBattry());
+ theModel.addAttribute("topRefillRimes", rimesService.getRefillRimes());
+
+ return "home";
+ }
+
+
+}
diff --git a/src/main/java/com/webapp/dao/BattryDAO.java b/src/main/java/com/webapp/dao/BattryDAO.java
new file mode 100644
index 0000000..d869f80
--- /dev/null
+++ b/src/main/java/com/webapp/dao/BattryDAO.java
@@ -0,0 +1,29 @@
+package com.webapp.dao;
+
+import java.util.List;
+
+import com.webapp.enity.Battries;
+
+
+public interface BattryDAO {
+
+ public List getBattries();
+
+ public void saveBattry(Battries theSalles);
+
+ public Battries getBattry(int theId);
+
+ public void deleteBattries(int theId);
+
+ public List getPagentionBattries();
+
+ public List top15Item();
+
+ public long TotalPrice();
+
+ public long TotalLength();
+
+ public List getRefillBattry();
+
+
+}
diff --git a/src/main/java/com/webapp/dao/BudgetDAO.java b/src/main/java/com/webapp/dao/BudgetDAO.java
new file mode 100644
index 0000000..3acf4af
--- /dev/null
+++ b/src/main/java/com/webapp/dao/BudgetDAO.java
@@ -0,0 +1,34 @@
+package com.webapp.dao;
+
+import java.util.List;
+
+import com.webapp.enity.Budget;
+
+public interface BudgetDAO {
+
+ public List getAllBudget();
+
+ public void saveBudget(Budget theBudget);
+
+ public Budget getBudget(int theId);
+
+ public void deleteBudget(int theId);
+
+ public List getAllIncome();
+
+ public List getAllExpences();
+
+ public List getIncomeThisMonth();
+
+ public List getExpencesThisMonth();
+
+ public long totalIncomeThisMonth();
+
+ public long totalExpencesThisMonth();
+
+ public long totalIncomeLastMonth();
+
+ public long totalExpencesLastMonth();
+
+
+}
diff --git a/src/main/java/com/webapp/dao/RimesDAO.java b/src/main/java/com/webapp/dao/RimesDAO.java
new file mode 100644
index 0000000..c0b3a42
--- /dev/null
+++ b/src/main/java/com/webapp/dao/RimesDAO.java
@@ -0,0 +1,28 @@
+package com.webapp.dao;
+
+import java.util.List;
+
+import com.webapp.enity.Rimes;
+
+
+public interface RimesDAO {
+
+ public List getRimes();
+
+ public void saveRimes(Rimes theRimes);
+
+ public Rimes getRimes(int theId);
+
+ public void deleteRimes(int theId);
+
+ public List getPagentionRimes();
+
+ public List top15Item();
+
+ public long TotalPrice();
+
+ public long TotalLength();
+
+ public List getRefillRimes();
+
+}
diff --git a/src/main/java/com/webapp/dao/SallesDAO.java b/src/main/java/com/webapp/dao/SallesDAO.java
new file mode 100644
index 0000000..16ad8ab
--- /dev/null
+++ b/src/main/java/com/webapp/dao/SallesDAO.java
@@ -0,0 +1,33 @@
+package com.webapp.dao;
+
+import java.util.List;
+
+import com.webapp.enity.Salles;
+
+public interface SallesDAO {
+
+ public List getAllSalles();
+
+ public void saveSalles(Salles theSalles);
+
+ public Salles getSalles(int theId);
+
+ public void deleteSalles(int theId);
+
+ public long totalSales();
+
+ public long totalThisMonth();
+
+ public long totalThisMonthByType(String Type);
+
+ public long totalLastMonth();
+
+ public long totalLastMonthByType(String Type);
+
+ public List topSallesItem();
+
+ public List