Index: sources/app/src/main/java/parkup/configs/RegistrationServiceW.java
===================================================================
--- sources/app/src/main/java/parkup/configs/RegistrationServiceW.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/configs/RegistrationServiceW.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -1,148 +1,148 @@
-package parkup.configs;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import parkup.configs.email.EmailSender;
-import parkup.configs.email.EmailValidator;
-import parkup.configs.token.ConfirmationTokenW;
-import parkup.configs.token.ConfirmationTokenService;
-import parkup.entities.Vraboten;
-import parkup.services.VrabotenService;
-
-import javax.transaction.Transactional;
-import java.time.LocalDateTime;
-
-@Service
-public class RegistrationServiceW {
-    private final VrabotenService vrabotenService;
-    private final EmailValidator emailValidator;
-    private final ConfirmationTokenService confirmationTokenService;
-    private final EmailSender emailSender;
-
-    @Autowired
-    public RegistrationServiceW(VrabotenService vrabotenService, EmailValidator emailValidator,
-                                 ConfirmationTokenService confirmationTokenService, EmailSender emailSender) {
-        this.vrabotenService = vrabotenService;
-        this.emailValidator = emailValidator;
-        this.confirmationTokenService = confirmationTokenService;
-        this.emailSender = emailSender;
-    }
-
-    public String register(RegistrationRequest request) {
-        boolean isValidEmail = emailValidator.
-                test(request.getEmail());
-
-        if (!isValidEmail) {
-            throw new IllegalStateException("email not valid");
-        }
-
-        String token = vrabotenService.signUpVraboten(
-                new Vraboten(
-                        request.getFirstName(),
-                        request.getLastName(),
-                        request.getEmail(),
-                        request.getPassword(),
-                        request.getMobile()
-                )
-        );
-
-        String link = "http://localhost:8080/vraboten/registration/confirm?token=" + token;
-        emailSender.send(
-                request.getEmail(),
-                buildEmail(request.getFirstName(), link));
-
-        return token;
-    }
-
-    @Transactional
-    public String confirmToken(String token) {
-        ConfirmationTokenW confirmationTokenW = confirmationTokenService
-                .getTokenW(token)
-                .orElseThrow(() ->
-                        new IllegalStateException("token not found"));
-
-        if (confirmationTokenW.getConfirmedAt() != null) {
-            throw new IllegalStateException("email already confirmed");
-        }
-
-        LocalDateTime expiredAt = confirmationTokenW.getExpiresAt();
-
-        if (expiredAt.isBefore(LocalDateTime.now())) {
-            throw new IllegalStateException("token expired");
-        }
-
-        confirmationTokenService.setConfirmedAtW(token);
-
-        vrabotenService.enableVraboten(confirmationTokenW.getRegistriranParkirac().getEmail());
-        return "confirmed";
-    }
-
-    private String buildEmail(String name, String link) {
-        return "<div style=\"font-family:Helvetica,Arial,sans-serif;font-size:16px;margin:0;color:#0b0c0c\">\n" +
-                "\n" +
-                "<span style=\"display:none;font-size:1px;color:#fff;max-height:0\"></span>\n" +
-                "\n" +
-                "  <table role=\"presentation\" width=\"100%\" style=\"border-collapse:collapse;min-width:100%;width:100%!important\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n" +
-                "    <tbody><tr>\n" +
-                "      <td width=\"100%\" height=\"53\" bgcolor=\"#0b0c0c\">\n" +
-                "        \n" +
-                "        <table role=\"presentation\" width=\"100%\" style=\"border-collapse:collapse;max-width:580px\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\">\n" +
-                "          <tbody><tr>\n" +
-                "            <td width=\"70\" bgcolor=\"#0b0c0c\" valign=\"middle\">\n" +
-                "                <table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse\">\n" +
-                "                  <tbody><tr>\n" +
-                "                    <td style=\"padding-left:10px\">\n" +
-                "                  \n" +
-                "                    </td>\n" +
-                "                    <td style=\"font-size:28px;line-height:1.315789474;Margin-top:4px;padding-left:10px\">\n" +
-                "                      <span style=\"font-family:Helvetica,Arial,sans-serif;font-weight:700;color:#ffffff;text-decoration:none;vertical-align:top;display:inline-block\">Confirm your email</span>\n" +
-                "                    </td>\n" +
-                "                  </tr>\n" +
-                "                </tbody></table>\n" +
-                "              </a>\n" +
-                "            </td>\n" +
-                "          </tr>\n" +
-                "        </tbody></table>\n" +
-                "        \n" +
-                "      </td>\n" +
-                "    </tr>\n" +
-                "  </tbody></table>\n" +
-                "  <table role=\"presentation\" class=\"m_-6186904992287805515content\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;max-width:580px;width:100%!important\" width=\"100%\">\n" +
-                "    <tbody><tr>\n" +
-                "      <td width=\"10\" height=\"10\" valign=\"middle\"></td>\n" +
-                "      <td>\n" +
-                "        \n" +
-                "                <table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse\">\n" +
-                "                  <tbody><tr>\n" +
-                "                    <td bgcolor=\"#1D70B8\" width=\"100%\" height=\"10\"></td>\n" +
-                "                  </tr>\n" +
-                "                </tbody></table>\n" +
-                "        \n" +
-                "      </td>\n" +
-                "      <td width=\"10\" valign=\"middle\" height=\"10\"></td>\n" +
-                "    </tr>\n" +
-                "  </tbody></table>\n" +
-                "\n" +
-                "\n" +
-                "\n" +
-                "  <table role=\"presentation\" class=\"m_-6186904992287805515content\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;max-width:580px;width:100%!important\" width=\"100%\">\n" +
-                "    <tbody><tr>\n" +
-                "      <td height=\"30\"><br></td>\n" +
-                "    </tr>\n" +
-                "    <tr>\n" +
-                "      <td width=\"10\" valign=\"middle\"><br></td>\n" +
-                "      <td style=\"font-family:Helvetica,Arial,sans-serif;font-size:19px;line-height:1.315789474;max-width:560px\">\n" +
-                "        \n" +
-                "            <p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\">Hi " + name + ",</p><p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\"> Thank you for registering. Please click on the below link to activate your account: </p><blockquote style=\"Margin:0 0 20px 0;border-left:10px solid #b1b4b6;padding:15px 0 0.1px 15px;font-size:19px;line-height:25px\"><p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\"> <a href=\"" + link + "\">Activate Now</a> </p></blockquote>\n Link will expire in 15 minutes. <p>See you soon</p>" +
-                "        \n" +
-                "      </td>\n" +
-                "      <td width=\"10\" valign=\"middle\"><br></td>\n" +
-                "    </tr>\n" +
-                "    <tr>\n" +
-                "      <td height=\"30\"><br></td>\n" +
-                "    </tr>\n" +
-                "  </tbody></table><div class=\"yj6qo\"></div><div class=\"adL\">\n" +
-                "\n" +
-                "</div></div>";
-    }
-}
+//package parkup.configs;
+//
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Service;
+//import parkup.configs.email.EmailSender;
+//import parkup.configs.email.EmailValidator;
+//import parkup.configs.token.ConfirmationTokenW;
+//import parkup.configs.token.ConfirmationTokenService;
+//import parkup.entities.Vraboten;
+//import parkup.services.VrabotenService;
+//
+//import javax.transaction.Transactional;
+//import java.time.LocalDateTime;
+//
+//@Service
+//public class RegistrationServiceW {
+//    private final VrabotenService vrabotenService;
+//    private final EmailValidator emailValidator;
+//    private final ConfirmationTokenService confirmationTokenService;
+//    private final EmailSender emailSender;
+//
+//    @Autowired
+//    public RegistrationServiceW(VrabotenService vrabotenService, EmailValidator emailValidator,
+//                                 ConfirmationTokenService confirmationTokenService, EmailSender emailSender) {
+//        this.vrabotenService = vrabotenService;
+//        this.emailValidator = emailValidator;
+//        this.confirmationTokenService = confirmationTokenService;
+//        this.emailSender = emailSender;
+//    }
+//
+//    public String register(RegistrationRequest request) {
+//        boolean isValidEmail = emailValidator.
+//                test(request.getEmail());
+//
+//        if (!isValidEmail) {
+//            throw new IllegalStateException("email not valid");
+//        }
+//
+//        String token = vrabotenService.signUpVraboten(
+//                new Vraboten(
+//                        request.getFirstName(),
+//                        request.getLastName(),
+//                        request.getEmail(),
+//                        request.getPassword(),
+//                        request.getMobile()
+//                )
+//        );
+//
+//        String link = "http://localhost:8080/vraboten/registration/confirm?token=" + token;
+//        emailSender.send(
+//                request.getEmail(),
+//                buildEmail(request.getFirstName(), link));
+//
+//        return token;
+//    }
+//
+//    @Transactional
+//    public String confirmToken(String token) {
+//        ConfirmationTokenW confirmationTokenW = confirmationTokenService
+//                .getTokenW(token)
+//                .orElseThrow(() ->
+//                        new IllegalStateException("token not found"));
+//
+//        if (confirmationTokenW.getConfirmedAt() != null) {
+//            throw new IllegalStateException("email already confirmed");
+//        }
+//
+//        LocalDateTime expiredAt = confirmationTokenW.getExpiresAt();
+//
+//        if (expiredAt.isBefore(LocalDateTime.now())) {
+//            throw new IllegalStateException("token expired");
+//        }
+//
+//        confirmationTokenService.setConfirmedAtW(token);
+//
+//        vrabotenService.enableVraboten(confirmationTokenW.getRegistriranParkirac().getEmail());
+//        return "confirmed";
+//    }
+//
+//    private String buildEmail(String name, String link) {
+//        return "<div style=\"font-family:Helvetica,Arial,sans-serif;font-size:16px;margin:0;color:#0b0c0c\">\n" +
+//                "\n" +
+//                "<span style=\"display:none;font-size:1px;color:#fff;max-height:0\"></span>\n" +
+//                "\n" +
+//                "  <table role=\"presentation\" width=\"100%\" style=\"border-collapse:collapse;min-width:100%;width:100%!important\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n" +
+//                "    <tbody><tr>\n" +
+//                "      <td width=\"100%\" height=\"53\" bgcolor=\"#0b0c0c\">\n" +
+//                "        \n" +
+//                "        <table role=\"presentation\" width=\"100%\" style=\"border-collapse:collapse;max-width:580px\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\">\n" +
+//                "          <tbody><tr>\n" +
+//                "            <td width=\"70\" bgcolor=\"#0b0c0c\" valign=\"middle\">\n" +
+//                "                <table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse\">\n" +
+//                "                  <tbody><tr>\n" +
+//                "                    <td style=\"padding-left:10px\">\n" +
+//                "                  \n" +
+//                "                    </td>\n" +
+//                "                    <td style=\"font-size:28px;line-height:1.315789474;Margin-top:4px;padding-left:10px\">\n" +
+//                "                      <span style=\"font-family:Helvetica,Arial,sans-serif;font-weight:700;color:#ffffff;text-decoration:none;vertical-align:top;display:inline-block\">Confirm your email</span>\n" +
+//                "                    </td>\n" +
+//                "                  </tr>\n" +
+//                "                </tbody></table>\n" +
+//                "              </a>\n" +
+//                "            </td>\n" +
+//                "          </tr>\n" +
+//                "        </tbody></table>\n" +
+//                "        \n" +
+//                "      </td>\n" +
+//                "    </tr>\n" +
+//                "  </tbody></table>\n" +
+//                "  <table role=\"presentation\" class=\"m_-6186904992287805515content\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;max-width:580px;width:100%!important\" width=\"100%\">\n" +
+//                "    <tbody><tr>\n" +
+//                "      <td width=\"10\" height=\"10\" valign=\"middle\"></td>\n" +
+//                "      <td>\n" +
+//                "        \n" +
+//                "                <table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse\">\n" +
+//                "                  <tbody><tr>\n" +
+//                "                    <td bgcolor=\"#1D70B8\" width=\"100%\" height=\"10\"></td>\n" +
+//                "                  </tr>\n" +
+//                "                </tbody></table>\n" +
+//                "        \n" +
+//                "      </td>\n" +
+//                "      <td width=\"10\" valign=\"middle\" height=\"10\"></td>\n" +
+//                "    </tr>\n" +
+//                "  </tbody></table>\n" +
+//                "\n" +
+//                "\n" +
+//                "\n" +
+//                "  <table role=\"presentation\" class=\"m_-6186904992287805515content\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;max-width:580px;width:100%!important\" width=\"100%\">\n" +
+//                "    <tbody><tr>\n" +
+//                "      <td height=\"30\"><br></td>\n" +
+//                "    </tr>\n" +
+//                "    <tr>\n" +
+//                "      <td width=\"10\" valign=\"middle\"><br></td>\n" +
+//                "      <td style=\"font-family:Helvetica,Arial,sans-serif;font-size:19px;line-height:1.315789474;max-width:560px\">\n" +
+//                "        \n" +
+//                "            <p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\">Hi " + name + ",</p><p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\"> Thank you for registering. Please click on the below link to activate your account: </p><blockquote style=\"Margin:0 0 20px 0;border-left:10px solid #b1b4b6;padding:15px 0 0.1px 15px;font-size:19px;line-height:25px\"><p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\"> <a href=\"" + link + "\">Activate Now</a> </p></blockquote>\n Link will expire in 15 minutes. <p>See you soon</p>" +
+//                "        \n" +
+//                "      </td>\n" +
+//                "      <td width=\"10\" valign=\"middle\"><br></td>\n" +
+//                "    </tr>\n" +
+//                "    <tr>\n" +
+//                "      <td height=\"30\"><br></td>\n" +
+//                "    </tr>\n" +
+//                "  </tbody></table><div class=\"yj6qo\"></div><div class=\"adL\">\n" +
+//                "\n" +
+//                "</div></div>";
+//    }
+//}
Index: sources/app/src/main/java/parkup/configs/WebSecurityConfig.java
===================================================================
--- sources/app/src/main/java/parkup/configs/WebSecurityConfig.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ 	(revision )
@@ -1,62 +1,0 @@
-package parkup.configs;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
-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.crypto.bcrypt.BCryptPasswordEncoder;
-import parkup.services.RegistriranParkiracService;
-import parkup.services.VrabotenService;
-
-@EnableWebSecurity
-@Configuration
-public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
-        private final VrabotenService vrabotenService;
-        private final BCryptPasswordEncoder bCryptPasswordEncoder;
-        private final RegistriranParkiracService registriranParkiracService;
-
-        public WebSecurityConfig(VrabotenService vrabotenService, BCryptPasswordEncoder bCryptPasswordEncoder, RegistriranParkiracService registriranParkiracService) {
-            this.vrabotenService = vrabotenService;
-            this.bCryptPasswordEncoder = bCryptPasswordEncoder;
-            this.registriranParkiracService = registriranParkiracService;
-        }
-
-        @Override
-        protected void configure(HttpSecurity http) throws Exception {
-            http
-                    .csrf().disable()
-                    .authorizeRequests()
-                        .antMatchers("/vraboten/registration/**")
-                        .permitAll()
-                        .antMatchers("/registriranParkirac/registration/**")
-                        .permitAll()
-                    .anyRequest()
-                    .authenticated().and().formLogin();
-        }
-
-        @Override
-        protected void configure(AuthenticationManagerBuilder auth) throws Exception {
-            auth.authenticationProvider(daoAuthenticationProviderW());
-            auth.authenticationProvider(daoAuthenticationProviderRP());
-        }
-
-        @Bean
-        public DaoAuthenticationProvider daoAuthenticationProviderW() {
-            DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
-            provider.setPasswordEncoder(bCryptPasswordEncoder);
-            provider.setUserDetailsService(vrabotenService);
-            return provider;
-        }
-
-        @Bean
-        public DaoAuthenticationProvider daoAuthenticationProviderRP(){
-            DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
-            provider.setPasswordEncoder(bCryptPasswordEncoder);
-            provider.setUserDetailsService(registriranParkiracService);
-            return provider;
-        }
-
-    }
Index: sources/app/src/main/java/parkup/configs/token/ConfirmationTokenService.java
===================================================================
--- sources/app/src/main/java/parkup/configs/token/ConfirmationTokenService.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/configs/token/ConfirmationTokenService.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -12,15 +12,9 @@
     private final ConfirmationTokenRepositoryW confirmationTokenRepositoryW;
 
-<<<<<<< HEAD
+
     public ConfirmationTokenService(ConfirmationTokenRepositoryRP confirmationTokenRepositoryRP, ConfirmationTokenRepositoryW confirmationTokenRepositoryW, parkup.configs.token.ConfirmationTokenRepositoryW confirmationTokenRepositoryW1) {
         this.confirmationTokenRepositoryRP = confirmationTokenRepositoryRP;
         this.confirmationTokenRepositoryW = confirmationTokenRepositoryW1;
-=======
-    public ConfirmationTokenService(ConfirmationTokenRepositoryRP confirmationTokenRepositoryRP, ConfirmationTokenRepositoryW confirmationTokenRepositoryW) {
-        this.confirmationTokenRepositoryRP = confirmationTokenRepositoryRP;
-        this.confirmationTokenRepositoryW = confirmationTokenRepositoryW;
->>>>>>> 9504a097ce80831ea7e7130dff7215d5fbf8e939
     }
-
     public void saveConfirmationTokenRP(ConfirmationTokenRP token){
         confirmationTokenRepositoryRP.save(token);
Index: sources/app/src/main/java/parkup/configs/webConfigs/WebSecurityConfig.java
===================================================================
--- sources/app/src/main/java/parkup/configs/webConfigs/WebSecurityConfig.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/configs/webConfigs/WebSecurityConfig.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -0,0 +1,60 @@
+package parkup.configs.webConfigs;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
+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.crypto.bcrypt.BCryptPasswordEncoder;
+import parkup.services.RegistriranParkiracService;
+import parkup.services.VrabotenService;
+
+@EnableWebSecurity
+@Configuration
+public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
+        private final VrabotenService vrabotenService;
+        private final BCryptPasswordEncoder bCryptPasswordEncoder;
+        private final RegistriranParkiracService registriranParkiracService;
+
+        public WebSecurityConfig(VrabotenService vrabotenService, BCryptPasswordEncoder bCryptPasswordEncoder, RegistriranParkiracService registriranParkiracService) {
+            this.vrabotenService = vrabotenService;
+            this.bCryptPasswordEncoder = bCryptPasswordEncoder;
+            this.registriranParkiracService = registriranParkiracService;
+        }
+
+        @Override
+        protected void configure(HttpSecurity http) throws Exception {
+            http
+                    .csrf().disable()
+                    .authorizeRequests()
+                        .antMatchers("/registriranParkirac/registration/**")
+                        .permitAll()
+                    .anyRequest()
+                    .authenticated().and().formLogin();//ruta na viktor
+        }
+
+        @Override
+        protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+            auth.authenticationProvider(daoAuthenticationProviderW());
+            auth.authenticationProvider(daoAuthenticationProviderRP());
+        }
+
+        @Bean
+        public DaoAuthenticationProvider daoAuthenticationProviderW() {
+            DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
+            provider.setPasswordEncoder(bCryptPasswordEncoder);
+            provider.setUserDetailsService(vrabotenService);
+            return provider;
+        }
+
+        @Bean
+        public DaoAuthenticationProvider daoAuthenticationProviderRP(){
+            DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
+            provider.setPasswordEncoder(bCryptPasswordEncoder);
+            provider.setUserDetailsService(registriranParkiracService);
+            return provider;
+        }
+
+    }
Index: sources/app/src/main/java/parkup/configs/webConfigs/WebSecurityConfigAdministrator.java
===================================================================
--- sources/app/src/main/java/parkup/configs/webConfigs/WebSecurityConfigAdministrator.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/configs/webConfigs/WebSecurityConfigAdministrator.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -0,0 +1,49 @@
+//package parkup.configs.webConfigs;
+//
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.context.annotation.Configuration;
+//import org.springframework.core.annotation.Order;
+//import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
+//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.crypto.bcrypt.BCryptPasswordEncoder;
+//import parkup.services.AdministratorService;
+//
+//@EnableWebSecurity
+//@Order(101)
+//@Configuration
+//public class WebSecurityConfigAdministrator extends WebSecurityConfigurerAdapter {
+//    private final AdministratorService administratorService;
+//    private final BCryptPasswordEncoder bCryptPasswordEncoder;
+//
+//    public WebSecurityConfigAdministrator(AdministratorService administratorService, BCryptPasswordEncoder bCryptPasswordEncoder) {
+//        this.administratorService = administratorService;
+//        this.bCryptPasswordEncoder = bCryptPasswordEncoder;
+//    }
+//
+//    @Override
+//    protected void configure(HttpSecurity http) throws Exception {
+//        http
+//                .csrf().disable()
+//                .authorizeRequests()
+//                .antMatchers("/administrator/registration/**")
+//                .permitAll()
+//                .anyRequest()
+//                .authenticated().and().formLogin();//ruta na viktor
+//    }
+//
+//    @Override
+//    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+//        auth.authenticationProvider(daoAuthenticationProviderA());
+//    }
+//
+//    @Bean
+//    public DaoAuthenticationProvider daoAuthenticationProviderA() {
+//        DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
+//        provider.setPasswordEncoder(bCryptPasswordEncoder);
+//        provider.setUserDetailsService(administratorService);
+//        return provider;
+//    }
+//}
Index: sources/app/src/main/java/parkup/configs/webConfigs/WebSecurityConfigRegistriranParkirac.java
===================================================================
--- sources/app/src/main/java/parkup/configs/webConfigs/WebSecurityConfigRegistriranParkirac.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/configs/webConfigs/WebSecurityConfigRegistriranParkirac.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -0,0 +1,49 @@
+//package parkup.configs.webConfigs;
+//
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.context.annotation.Configuration;
+//import org.springframework.core.annotation.Order;
+//import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
+//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.crypto.bcrypt.BCryptPasswordEncoder;
+//import parkup.services.RegistriranParkiracService;
+//
+//@EnableWebSecurity
+//@Order(100)
+//@Configuration
+//public class WebSecurityConfigRegistriranParkirac extends WebSecurityConfigurerAdapter {
+//    private final BCryptPasswordEncoder bCryptPasswordEncoder;
+//    private final RegistriranParkiracService registriranParkiracService;
+//
+//    public WebSecurityConfigRegistriranParkirac(RegistriranParkiracService registriranParkiracService, BCryptPasswordEncoder bCryptPasswordEncoder) {
+//        this.bCryptPasswordEncoder = bCryptPasswordEncoder;
+//        this.registriranParkiracService = registriranParkiracService;
+//    }
+//
+//    @Override
+//    protected void configure(HttpSecurity http) throws Exception {
+//        http
+//                .csrf().disable()
+//                .authorizeRequests()
+//                .antMatchers("/registriranParkirac/registration/**")
+//                .permitAll()
+//                .anyRequest()
+//                .authenticated().and().formLogin();//ruta na viktor
+//    }
+//
+//    @Override
+//    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+//        auth.authenticationProvider(daoAuthenticationProviderRP());
+//    }
+//
+//    @Bean
+//    public DaoAuthenticationProvider daoAuthenticationProviderRP(){
+//        DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
+//        provider.setPasswordEncoder(bCryptPasswordEncoder);
+//        provider.setUserDetailsService(registriranParkiracService);
+//        return provider;
+//    }
+//}
Index: sources/app/src/main/java/parkup/configs/webConfigs/WebSecurityConfigVraboten.java
===================================================================
--- sources/app/src/main/java/parkup/configs/webConfigs/WebSecurityConfigVraboten.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/configs/webConfigs/WebSecurityConfigVraboten.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -0,0 +1,51 @@
+//package parkup.configs.webConfigs;
+//
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.context.annotation.Configuration;
+//import org.springframework.core.annotation.Order;
+//import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
+//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.crypto.bcrypt.BCryptPasswordEncoder;
+//import parkup.services.VrabotenService;
+//
+//@EnableWebSecurity
+//@Order(99)
+//@Configuration
+//public class WebSecurityConfigVraboten extends WebSecurityConfigurerAdapter {
+//    private final VrabotenService vrabotenService;
+//    private final BCryptPasswordEncoder bCryptPasswordEncoder;
+//
+//    public WebSecurityConfigVraboten(VrabotenService vrabotenService, BCryptPasswordEncoder bCryptPasswordEncoder) {
+//        this.vrabotenService = vrabotenService;
+//        this.bCryptPasswordEncoder = bCryptPasswordEncoder;
+//    }
+//
+//    @Override
+//    protected void configure(HttpSecurity http) throws Exception {
+//        http
+//                .csrf().disable()
+//                .authorizeRequests()
+//                .antMatchers("/vraboten/registration/**")
+//                .permitAll()
+//                .anyRequest()
+//                .authenticated()
+//                .and()
+//                .formLogin();//ruta na viktor
+//    }
+//
+//    @Override
+//    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+//        auth.authenticationProvider(daoAuthenticationProviderW());
+//    }
+//
+//    @Bean
+//    public DaoAuthenticationProvider daoAuthenticationProviderW() {
+//        DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
+//        provider.setPasswordEncoder(bCryptPasswordEncoder);
+//        provider.setUserDetailsService(vrabotenService);
+//        return provider;
+//    }
+//}
Index: sources/app/src/main/java/parkup/controllers/ParkingSessionController.java
===================================================================
--- sources/app/src/main/java/parkup/controllers/ParkingSessionController.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/controllers/ParkingSessionController.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -3,4 +3,5 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+import parkup.data.Tablicka;
 import parkup.entities.ParkingSession;
 import parkup.services.ParkingSessionService;
@@ -33,14 +34,34 @@
     }
 
-    @PostMapping({"/parkingSession"})
-    public Optional<ParkingSession> addParkingSession(@RequestBody ParkingSession parkingSession) {
-        //System.out.println("???????");
-        return this.parkingSessionService.addParkingSession(parkingSession);
+    @PostMapping({"/parkingSession/{parkingZoneId}"})
+    public Optional<ParkingSession> startParkingSession(@RequestParam String tablicka, @PathVariable int parkingZoneId) {
+        return this.parkingSessionService.startParkingSession(tablicka,parkingZoneId);
     }
+// TODO: vidi kako kje funkcionira update na sesija i nejzino plakjanje so frontot
 
-    @PutMapping({"/parkingSession/{parkingSessionId}"})
-    public void updateParkingSession(@PathVariable int parkingSessionId, @RequestBody ParkingSession parkingSession) {
-        parkingSessionService.updateParkingSession(parkingSessionId,
-                parkingSession.getTimeStart(), parkingSession.getTimeEnd(), parkingSession.getTablica());
+//    @PutMapping({"/parkingSession/{parkingSessionId}"})
+//    public void updateParkingSession(@PathVariable int parkingSessionId, @RequestBody ParkingSession parkingSession) {
+//        parkingSessionService.updateParkingSession(parkingSessionId,
+//                parkingSession.getTimeStart(), parkingSession.getTimeEnd(), parkingSession.getTablica());
+//    }
+//    @PutMapping({"/parkingSession/pay/{parkingSessionId"})
+//    public void payParkingSession(@PathVariable int parkingSessionId){
+//        parkingSessionService.paySession
+//    }
+    @PutMapping("/parkingSession/end/{parkingSessionId}")
+    public ParkingSession endParkingSession(@PathVariable int parkingSessionId){
+        return this.parkingSessionService.endParkingSession(parkingSessionId);
+    }
+    @PutMapping("/parkingSession/verify/{parkingSessionId}")
+    public ParkingSession verifyParkingSession(@PathVariable int parkingSessionId,@RequestParam String parkingSpaceName,@RequestParam int parkingZoneId){
+        return this.parkingSessionService.verifyParkingSession(parkingSessionId,parkingSpaceName,parkingZoneId);
+    }
+    @GetMapping("/parkingSession/calculate/{parkingSessionId}")
+    public int calculateParkingSession(@PathVariable int parkingSessionId){
+        return this.parkingSessionService.calculatePayment(parkingSessionId);
+    }
+    @PutMapping("/parkingSession/pay/{parkingSessionId}")
+    public boolean payParkingSession(@PathVariable int parkingSessionId,@RequestParam String expireDate){
+        return this.parkingSessionService.payParkingSession(parkingSessionId,expireDate);
     }
 
Index: sources/app/src/main/java/parkup/controllers/ParkingSpaceController.java
===================================================================
--- sources/app/src/main/java/parkup/controllers/ParkingSpaceController.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/controllers/ParkingSpaceController.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -33,18 +33,12 @@
     }
 
-    @PostMapping({"/parkingSpace"})
-    public Optional<ParkingSpace> addParkingSpace(@RequestBody ParkingSpace parkingSpace) {
-<<<<<<< HEAD
-        System.out.println("???????");
-=======
-        //System.out.println("???????");
->>>>>>> 9504a097ce80831ea7e7130dff7215d5fbf8e939
-        return this.parkingSpaceService.addParkingSpace(parkingSpace);
+    @PostMapping({"/parkingSpace/add/{parkingZoneId}"})
+    public Optional<ParkingSpace> addParkingSpace(@RequestBody ParkingSpace parkingSpace,@PathVariable int parkingZoneId) {
+        return this.parkingSpaceService.addParkingSpace(parkingSpace,parkingZoneId);
     }
 
     @PutMapping({"/parkingSpace/{parkingSpaceId}"})
     public void updateParkingSpace(@PathVariable int parkingSpaceId, @RequestBody ParkingSpace parkingSpace) {
-        parkingSpaceService.updateParkingSpace(parkingSpaceId, parkingSpace.getPsName(), parkingSpace.isTaken(),
-                parkingSpace.isHandicaped(), parkingSpace.getLat(), parkingSpace.getLng());
+        parkingSpaceService.updateParkingSpace(parkingSpaceId, parkingSpace.getPsName(), parkingSpace.isTaken(), parkingSpace.getLat(), parkingSpace.getLng());
     }
 
Index: sources/app/src/main/java/parkup/controllers/ParkingZoneController.java
===================================================================
--- sources/app/src/main/java/parkup/controllers/ParkingZoneController.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/controllers/ParkingZoneController.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -3,4 +3,5 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+import parkup.data.ParkingZoneAdminView;
 import parkup.entities.ParkingZone;
 import parkup.services.ParkingZoneService;
@@ -49,12 +50,9 @@
 
     @PutMapping({"/parkingZone/{parkingZoneId}"})
-    public ParkingZone updateParkingZone(@PathVariable int parkingZoneId, @RequestBody ParkingZone parkingZone) {
-        return this.parkingZoneService.updateParkingZone(parkingZoneId, parkingZone.getPzName(), parkingZone.getPrice(), parkingZone.getCapacity(),
-                parkingZone.getLocation(), parkingZone.getFrom(), parkingZone.getTo(), parkingZone.getColor(),
-<<<<<<< HEAD
+    public ParkingZone updateParkingZone(@PathVariable int parkingZoneId, @RequestBody ParkingZoneAdminView parkingZone) {
+        return this.parkingZoneService.updateParkingZone(parkingZoneId, parkingZone.getPzName(), parkingZone.getPrice(),
+                parkingZone.getAddress(), parkingZone.getTime_from(), parkingZone.getTime_to(), parkingZone.getColor(),
                 parkingZone.getParkingSpaces(), parkingZone.getParkingZoneLocation(),parkingZone.getOdgovorniLica());
-=======
-                parkingZone.getParkingSpaces(), parkingZone.getParkingZoneLocation());
->>>>>>> 9504a097ce80831ea7e7130dff7215d5fbf8e939
+
     }
 
Index: sources/app/src/main/java/parkup/controllers/VrabotenController.java
===================================================================
--- sources/app/src/main/java/parkup/controllers/VrabotenController.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/controllers/VrabotenController.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -3,9 +3,12 @@
 import java.util.List;
 import java.util.Optional;
+import java.util.stream.Collectors;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import parkup.configs.RegistrationRequest;
-import parkup.configs.RegistrationServiceW;
+//import parkup.configs.RegistrationServiceW;
+import parkup.data.AddUpdateVraboten;
+import parkup.data.enumarations.EmployeeStatus;
 import parkup.entities.Vraboten;
 import parkup.services.VrabotenService;
@@ -15,10 +18,9 @@
 public class VrabotenController {
     private final VrabotenService vrabotenService;
-    private final RegistrationServiceW registrationServiceW;
+//    private final RegistrationServiceW registrationServiceW;
 
     @Autowired
-    public VrabotenController(VrabotenService vrabotenService, RegistrationServiceW registrationServiceW) {
+    public VrabotenController(VrabotenService vrabotenService) {
         this.vrabotenService = vrabotenService;
-        this.registrationServiceW = registrationServiceW;
     }
 
@@ -44,17 +46,23 @@
 
     @PostMapping({"/vraboten"})
-    public Optional<Vraboten> addVraboten(@RequestBody Vraboten vraboten) {
-        return this.vrabotenService.addVraboten(vraboten);
+    public Optional<Vraboten> addVraboten(@RequestBody AddUpdateVraboten vraboten) {
+        return this.vrabotenService.addVraboten(vraboten.getPassword(), vraboten.getConfirmPass(), vraboten.isLocked(),vraboten.getFirstName(), vraboten.getLastName(),
+                vraboten.getMobileNumber(), vraboten.getEmail(), vraboten.getStatus(),vraboten.getParkingZones());
     }
 
-    @PostMapping({"/vraboten/{vrabotenId}"})
+    @PutMapping({"/vraboten/lock/{vrabotenId}"})
     public void lockVraboten(@PathVariable int vrabotenId) {
         this.vrabotenService.lockVrabotenAcc(vrabotenId);
     }
 
+//    @PostMapping({"/vraboten/setStatus/{vrabotenId}"})
+//    public void setVrabotenStatus(@PathVariable int vrabotenId,@RequestParam String vrabotenStatus){
+//        this.vrabotenService.setVrabotenStatus(vrabotenId,vrabotenStatus);
+//    }
+
     @PutMapping({"/vraboten/{vrabotenId}"})
-    public Vraboten updateVraboten(@PathVariable int vrabotenId, @RequestBody Vraboten vraboten) {
-        return this.vrabotenService.updateVraboten(vrabotenId, vraboten.getFirstName(), vraboten.getLastName(),
-                vraboten.getMobile(), vraboten.getEmail(), vraboten.getStatus());
+    public Vraboten updateVraboten(@PathVariable int vrabotenId, @RequestBody AddUpdateVraboten vraboten) {
+        return this.vrabotenService.updateVraboten(vrabotenId,vraboten.getPassword(), vraboten.getConfirmPass(), vraboten.isLocked(),vraboten.getFirstName(), vraboten.getLastName(),
+                vraboten.getMobileNumber(), vraboten.getEmail(), vraboten.getStatus(),vraboten.getParkingZones());
     }
 
@@ -64,12 +72,12 @@
     }
 
-    @PostMapping({"/vraboten/registration"})
-    public String register(@RequestBody RegistrationRequest request){
-        return registrationServiceW.register(request);
-    }
-
-    @GetMapping(path = "/vraboten/registration/confirm")
-    public String confirm(@RequestParam("token") String token) {
-        return registrationServiceW.confirmToken(token);
-    }
+//    @PostMapping({"/vraboten/registration"})
+//    public String register(@RequestBody RegistrationRequest request){
+//        return registrationServiceW.register(request);
+//    }
+//
+//    @GetMapping(path = "/vraboten/registration/confirm")
+//    public String confirm(@RequestParam("token") String token) {
+//        return registrationServiceW.confirmToken(token);
+//    }
 }
Index: sources/app/src/main/java/parkup/data/AddUpdateVraboten.java
===================================================================
--- sources/app/src/main/java/parkup/data/AddUpdateVraboten.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/data/AddUpdateVraboten.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -0,0 +1,102 @@
+package parkup.data;
+
+import parkup.data.enumarations.EmployeeStatus;
+
+import java.util.List;
+
+public class AddUpdateVraboten {
+    String firstName;
+    String lastName;
+    String email;
+    String password;
+    String confirmPass;
+    List<String> parkingZones;
+    EmployeeStatus status;
+    String mobileNumber;
+    boolean locked;
+
+    public AddUpdateVraboten(String firstName, String lastName, String email, String password, String confirmPass, List<String> parkingZones, EmployeeStatus status, String mobileNumber, boolean locked) {
+        this.firstName = firstName;
+        this.lastName = lastName;
+        this.email = email;
+        this.password = password;
+        this.confirmPass = confirmPass;
+        this.parkingZones = parkingZones;
+        this.status = status;
+        this.mobileNumber = mobileNumber;
+        this.locked = locked;
+    }
+
+    public String getFirstName() {
+        return firstName;
+    }
+
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    public String getLastName() {
+        return lastName;
+    }
+
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getConfirmPass() {
+        return confirmPass;
+    }
+
+    public void setConfirmPass(String confirmPass) {
+        this.confirmPass = confirmPass;
+    }
+
+    public List<String> getParkingZones() {
+        return parkingZones;
+    }
+
+    public void setParkingZones(List<String> parkingZones) {
+        this.parkingZones = parkingZones;
+    }
+
+    public EmployeeStatus getStatus() {
+        return status;
+    }
+
+    public void setStatus(EmployeeStatus status) {
+        this.status = status;
+    }
+
+    public String getMobileNumber() {
+        return mobileNumber;
+    }
+
+    public void setMobileNumber(String mobileNumber) {
+        this.mobileNumber = mobileNumber;
+    }
+
+    public boolean isLocked() {
+        return locked;
+    }
+
+    public void setLocked(boolean locked) {
+        this.locked = locked;
+    }
+}
+
Index: sources/app/src/main/java/parkup/data/ParkingSpaceAdminView.java
===================================================================
--- sources/app/src/main/java/parkup/data/ParkingSpaceAdminView.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/data/ParkingSpaceAdminView.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -0,0 +1,9 @@
+package parkup.data;
+
+public class ParkingSpaceAdminView {
+    private int psId;
+    private String psName;
+    private float lat;
+    private float lng;
+
+}
Index: sources/app/src/main/java/parkup/data/ParkingZoneAdminView.java
===================================================================
--- sources/app/src/main/java/parkup/data/ParkingZoneAdminView.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/data/ParkingZoneAdminView.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -0,0 +1,113 @@
+package parkup.data;
+
+import parkup.entities.ParkingSpace;
+
+import java.util.List;
+
+public class ParkingZoneAdminView {
+    private int pzId;
+    private String pzName;
+    private int price;
+    private int time_from;
+    private int time_to;
+    private String address;
+    private String color;
+    private List<ParkingSpace> parkingSpaces;
+    private ParkingZoneLocation parkingZoneLocation;
+    private List<Integer> odgovorniLica;
+
+    public ParkingZoneAdminView(int pzId, String pzName, int price, int time_from, int time_to, String address, String color, List<ParkingSpace> parkingSpaces, ParkingZoneLocation parkingZoneLocation, List<Integer> odgovorniLica) {
+        this.pzId = pzId;
+        this.pzName = pzName;
+        this.price = price;
+        this.time_from = time_from;
+        this.time_to = time_to;
+        this.address = address;
+        this.color = color;
+        this.parkingSpaces = parkingSpaces;
+        this.parkingZoneLocation = parkingZoneLocation;
+        this.odgovorniLica = odgovorniLica;
+    }
+
+    public ParkingZoneAdminView() {}
+
+    public int getPzId() {
+        return pzId;
+    }
+
+    public void setPzId(int pzId) {
+        this.pzId = pzId;
+    }
+
+    public String getPzName() {
+        return pzName;
+    }
+
+    public void setPzName(String pzName) {
+        this.pzName = pzName;
+    }
+
+    public int getPrice() {
+        return price;
+    }
+
+    public void setPrice(int price) {
+        this.price = price;
+    }
+
+    public int getTime_from() {
+        return time_from;
+    }
+
+    public void setTime_from(int time_from) {
+        this.time_from = time_from;
+    }
+
+    public int getTime_to() {
+        return time_to;
+    }
+
+    public void setTime_to(int time_to) {
+        this.time_to = time_to;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    public String getColor() {
+        return color;
+    }
+
+    public void setColor(String color) {
+        this.color = color;
+    }
+
+    public List<ParkingSpace> getParkingSpaces() {
+        return parkingSpaces;
+    }
+
+    public void setParkingSpaces(List<ParkingSpace> parkingSpaces) {
+        this.parkingSpaces = parkingSpaces;
+    }
+
+    public ParkingZoneLocation getParkingZoneLocation() {
+        return parkingZoneLocation;
+    }
+
+    public void setParkingZoneLocation(ParkingZoneLocation parkingZoneLocation) {
+        this.parkingZoneLocation = parkingZoneLocation;
+    }
+
+    public List<Integer> getOdgovorniLica() {
+        return odgovorniLica;
+    }
+
+    public void setOdgovorniLica(List<Integer> odgovorniLica) {
+        this.odgovorniLica = odgovorniLica;
+    }
+}
Index: sources/app/src/main/java/parkup/data/ParkingZoneLocation.java
===================================================================
--- sources/app/src/main/java/parkup/data/ParkingZoneLocation.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/data/ParkingZoneLocation.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -20,8 +20,8 @@
     private int parkingZoneLocationId;
 
-    @OneToOne
+    @OneToOne(cascade = {CascadeType.ALL})
     private Location centre;
 
-    @OneToMany
+    @OneToMany(cascade = {CascadeType.ALL})
     private List<Location> teminja;
 
Index: sources/app/src/main/java/parkup/data/VrabotenDemo.java
===================================================================
--- sources/app/src/main/java/parkup/data/VrabotenDemo.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/data/VrabotenDemo.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -2,5 +2,5 @@
 
 public class VrabotenDemo {
-
+    private int vrabotenId;
     private String firstName;
     private String lastName;
@@ -9,8 +9,17 @@
     public VrabotenDemo() {}
 
-    public VrabotenDemo(String firstName, String lastName, String email) {
+    public VrabotenDemo(int id,String firstName, String lastName, String email) {
+        this.vrabotenId=id;
         this.firstName = firstName;
         this.lastName = lastName;
         this.email = email;
+    }
+
+    public int getVrabotenId() {
+        return vrabotenId;
+    }
+
+    public void setVrabotenId(int vrabotenId) {
+        this.vrabotenId = vrabotenId;
     }
 
Index: sources/app/src/main/java/parkup/data/enumarations/EmployeeStatus.java
===================================================================
--- sources/app/src/main/java/parkup/data/enumarations/EmployeeStatus.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/data/enumarations/EmployeeStatus.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -0,0 +1,8 @@
+package parkup.data.enumarations;
+
+public enum EmployeeStatus {
+    WORKING,
+    NOT_WORKING,
+    VACATION,
+    PAID_LEAVE
+}
Index: sources/app/src/main/java/parkup/data/enumarations/SessionStatus.java
===================================================================
--- sources/app/src/main/java/parkup/data/enumarations/SessionStatus.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/data/enumarations/SessionStatus.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -0,0 +1,8 @@
+package parkup.data.enumarations;
+
+public enum SessionStatus {
+    STARTED_VERIFIED,
+    STARTED_UNVERIFIED,
+    ENDED_UNPAID,
+    ENDED_PAID
+}
Index: sources/app/src/main/java/parkup/entities/Guest.java
===================================================================
--- sources/app/src/main/java/parkup/entities/Guest.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/entities/Guest.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -32,4 +32,7 @@
     @Column(name = "mobile")
     private String mobile;
+
+    @OneToOne
+    private ParkingSession session;
 
     public Guest() {}
Index: sources/app/src/main/java/parkup/entities/ParkingSession.java
===================================================================
--- sources/app/src/main/java/parkup/entities/ParkingSession.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/entities/ParkingSession.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -1,7 +1,10 @@
 package parkup.entities;
 
+import org.springframework.format.annotation.DateTimeFormat;
 import parkup.data.Tablicka;
+import parkup.data.enumarations.SessionStatus;
 
 import javax.persistence.*;
+import java.time.LocalDateTime;
 
 @Entity
@@ -22,9 +25,11 @@
     private int pssId;
 
+    @DateTimeFormat(pattern = "yyyy-MM-dd-HH-mm-ss")
     @Column(name = "time_start")
-    private String timeStart;
+    private LocalDateTime timeStart;
 
+    @DateTimeFormat(pattern = "yyyy-MM-dd-HH-mm-ss")
     @Column(name = "time_end")
-    private String timeEnd;
+    private LocalDateTime timeEnd;
 
     @OneToOne(cascade = {CascadeType.ALL})
@@ -32,18 +37,34 @@
     private Tablicka tablica;
 
-    public ParkingSession() {}
+    @Column(name="session_status")
+    @Enumerated
+    private SessionStatus status;
 
-    public ParkingSession(int pssId, String timeStart, String timeEnd, Tablicka tablica) {
-        this.pssId = pssId;
-        this.timeStart = timeStart;
-        this.timeEnd = timeEnd;
-        this.tablica = tablica;
+    @ManyToOne
+    private ParkingSpace parkingSpace;
+
+    @ManyToOne
+    private ParkingZone parkingZone;
+
+
+//    public ParkingSpace getParkingSpace() {
+//        return parkingSpace;
+//    }
+//
+//    public void setParkingSpace(ParkingSpace parkingSpace) {
+//        this.parkingSpace = parkingSpace;
+//    }
+
+    public ParkingSession() {
+
     }
 
-    public ParkingSession(String timeStart, String timeEnd, Tablicka tablica) {
-        this.timeStart = timeStart;
-        this.timeEnd = timeEnd;
-        this.tablica = tablica;
+    public ParkingSession(Tablicka tablica){
+        this.timeStart= LocalDateTime.now();
+        this.timeEnd=null;
+        this.tablica=tablica;
+        this.status=SessionStatus.STARTED_UNVERIFIED;
     }
+
 
     public int getPssId() {
@@ -55,17 +76,17 @@
     }
 
-    public String getTimeStart() {
-        return this.timeStart;
+    public LocalDateTime getTimeStart() {
+        return timeStart;
     }
 
-    public void setTimeStart(String timeStart) {
+    public void setTimeStart(LocalDateTime timeStart) {
         this.timeStart = timeStart;
     }
 
-    public String getTimeEnd() {
-        return this.timeEnd;
+    public LocalDateTime getTimeEnd() {
+        return timeEnd;
     }
 
-    public void setTimeEnd(String timeEnd) {
+    public void setTimeEnd(LocalDateTime timeEnd) {
         this.timeEnd = timeEnd;
     }
@@ -78,3 +99,27 @@
         this.tablica = tablica;
     }
+
+    public SessionStatus getStatus() {
+        return status;
+    }
+
+    public void setStatus(SessionStatus status) {
+        this.status = status;
+    }
+
+    public ParkingSpace getParkingSpace() {
+        return parkingSpace;
+    }
+
+    public ParkingZone getParkingZone() {
+        return parkingZone;
+    }
+
+    public void setParkingSpace(ParkingSpace parkingSpace) {
+        this.parkingSpace = parkingSpace;
+    }
+
+    public void setParkingZone(ParkingZone parkingZone) {
+        this.parkingZone = parkingZone;
+    }
 }
Index: sources/app/src/main/java/parkup/entities/ParkingSpace.java
===================================================================
--- sources/app/src/main/java/parkup/entities/ParkingSpace.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/entities/ParkingSpace.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -2,4 +2,6 @@
 
 import javax.persistence.*;
+import java.util.ArrayList;
+import java.util.List;
 
 @Entity
@@ -24,12 +26,9 @@
 
     @Column(name = "isTaken")
-    private Boolean isTaken;
-
-    @Column(name = "isHandicaped")
-    private Boolean isHandicaped;
+    private boolean taken;
 
     @Column(name = "latitude")
     private float lat;
-<<<<<<< HEAD
+
 
     @Column(name = "longitude")
@@ -39,34 +38,27 @@
 //    @JoinColumn(name = "parking_zona")
 //    private ParkingZone parkingZone;
+//    @ManyToOne(cascade = {CascadeType.ALL})
+//    @JoinColumn(name = "parking_zona")
+//    private ParkingZone parkingZone;
+//
+//    @OneToMany
+//    @Column(name="parking_sessions")
+//    private List<ParkingSession> sessions;
 
     public ParkingSpace() {
-        System.out.println("Default ParkingSpace constructor" + lat);
+
     }
 
-=======
-
-    @Column(name = "longitude")
-    private float lng;
-
-    @OneToOne(cascade = {CascadeType.ALL})
-    @JoinColumn(name = "parking_zona")
-    private ParkingZone parkingZone;
-
-    public ParkingSpace() {}
-
->>>>>>> 9504a097ce80831ea7e7130dff7215d5fbf8e939
-    public ParkingSpace(int psId, String psName, boolean isTaken, boolean isHandicaped, float lat, float lng) {
+    public ParkingSpace(int psId, String psName, boolean isTaken,  float lat, float lng) {
         this.psId = psId;
         this.psName = psName;
-        this.isTaken = isTaken;
-        this.isHandicaped = isHandicaped;
+        this.taken = isTaken;
         this.lat = lat;
         this.lng = lng;
     }
 
-    public ParkingSpace(String psName, boolean isTaken, boolean isHandicaped, float lat, float lng) {
+    public ParkingSpace(String psName,  float lat, float lng) {
         this.psName = psName;
-        this.isTaken = isTaken;
-        this.isHandicaped = isHandicaped;
+        this.taken = false;
         this.lat = lat;
         this.lng = lng;
@@ -76,4 +68,13 @@
         return this.psId;
     }
+
+//    public ParkingZone getParkingZone() {
+//        return parkingZone;
+//    }
+//
+//    public void setParkingZone(ParkingZone parkingZone) {
+//        this.parkingZone = parkingZone;
+//    }
+
 
     public void setPsId(int psId) {
@@ -90,17 +91,9 @@
 
     public boolean isTaken() {
-        return this.isTaken;
+        return this.taken;
     }
 
     public void setTaken(boolean isTaken) {
-        this.isTaken = isTaken;
-    }
-
-    public boolean isHandicaped() {
-        return this.isHandicaped;
-    }
-
-    public void setHandicaped(boolean isHandicaped) {
-        this.isHandicaped = isHandicaped;
+        this.taken = isTaken;
     }
 
@@ -120,5 +113,5 @@
         this.lng = lng;
     }
-<<<<<<< HEAD
+
 
     @Override
@@ -126,12 +119,9 @@
         return "ParkingSpace{" +
                 "psName='" + psName + '\'' +
-                ", isTaken=" + isTaken +
-                ", isHandicaped=" + isHandicaped +
+                ", isTaken=" + taken +
                 ", lat=" + lat +
                 ", lng=" + lng+
                 '}';
     }
-=======
->>>>>>> 9504a097ce80831ea7e7130dff7215d5fbf8e939
 }
 
Index: sources/app/src/main/java/parkup/entities/ParkingZone.java
===================================================================
--- sources/app/src/main/java/parkup/entities/ParkingZone.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/entities/ParkingZone.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -30,35 +30,30 @@
     private int price;
 
+    @Transient
     @Column(name = "capacity")
     private int capacity;
-
-<<<<<<< HEAD
     @Column(name = "time_from")  //za rabotni casovi od:
     private int from;
 
     @Column(name = "time_to")    //za rabotni casovi do:
-=======
-    @Column(name = "vreme_od")  //za rabotni casovi od:
-    private int from;
-
-    @Column(name = "vreme_do")    //za rabotni casovi do:
->>>>>>> 9504a097ce80831ea7e7130dff7215d5fbf8e939
     private int to;
 
-    @Column(name = "lokacija")
-    private String location;
+    @Column(name = "address")
+    private String address;
 
+    @Transient
     @Column(name = "zafateniMesta")
-    private int zafateniMesta;
+    private int takenSpaces;
 
     @Column(name = "color")
     private String color;
 
-    @ManyToMany(cascade = {CascadeType.ALL})
-    @JoinColumn(name="odgovorniLica",nullable = true)
-    private List<Vraboten> odgovorniLica;
+//    @ManyToMany(cascade = {CascadeType.ALL})
+//    private List<Vraboten> odgovorniLica;
 
-    @OneToMany(cascade = {CascadeType.ALL})
+    @OneToMany(cascade = {CascadeType.MERGE})
     private List<ParkingSpace> parkingSpaces;
+
+
 
     @OneToOne(cascade = {CascadeType.ALL})
@@ -66,5 +61,5 @@
 
    public ParkingZone() {
-       this.zafateniMesta = 0;
+       this.takenSpaces = 0;
        this.parkingSpaces = new ArrayList<ParkingSpace>();
    }
@@ -72,15 +67,15 @@
     public ParkingZone(String pzName) {
         this.pzName = pzName;
-        this.zafateniMesta = 0;
+        this.takenSpaces = 0;
         this.parkingSpaces = new ArrayList<ParkingSpace>();
     }
 
-    public ParkingZone(int pzId, String pzName, int price, int capacity, String location, List<ParkingSpace> parkingSpaces, String color, int from, int to) {
+    public ParkingZone(int pzId, String pzName, int price, int capacity, String address, List<ParkingSpace> parkingSpaces, String color, int from, int to) {
         this.pzId = pzId;
         this.pzName = pzName;
         this.price = price;
         this.capacity = capacity;
-        this.location = location;
-        this.zafateniMesta = 0;
+        this.address = address;
+        this.takenSpaces = 0;
         this.parkingSpaces = parkingSpaces;
         this.color = color;
@@ -89,10 +84,10 @@
     }
 
-    public ParkingZone(String pzName, int price, int capacity, String location, List<ParkingSpace> parkingSpaces, String color, int from, int to) {
+    public ParkingZone(String pzName, int price, int capacity, String address, List<ParkingSpace> parkingSpaces, String color, int from, int to) {
         this.pzName = pzName;
         this.price = price;
         this.capacity = capacity;
-        this.location = location;
-        this.zafateniMesta = 0;
+        this.address = address;
+        this.takenSpaces = 0;
         this.parkingSpaces = parkingSpaces;
         this.color = color;
@@ -133,15 +128,15 @@
     }
 
-    public String getLocation() {
-        return this.location;
+    public String getAddress() {
+        return this.address;
     }
 
-    public void setLocation(String location) {
-        this.location = location;
+    public void setAddress(String location) {
+        this.address = location;
     }
 
-    public int getZafateniMesta() {return zafateniMesta;}
+    public int getTakenSpaces() {return takenSpaces;}
 
-    public void setZafateniMesta(int zafateniMesta) {this.zafateniMesta = zafateniMesta;}
+    public void setTakenSpaces(int takenSpaces) {this.takenSpaces = takenSpaces;}
 
     public List<ParkingSpace> getParkingSpaces() {return parkingSpaces;}
@@ -181,10 +176,10 @@
     }
 
-    public List<Vraboten> getOdgovorniLica() {
-        return odgovorniLica;
-    }
-
-    public void setOdgovorniLica(List<Vraboten> odgovorniLica) {
-        this.odgovorniLica = odgovorniLica;
-    }
+    //    public List<Vraboten> getOdgovorniLica() {
+//        return odgovorniLica;
+//    }
+//
+//    public void setOdgovorniLica(List<Vraboten> odgovorniLica) {
+//        this.odgovorniLica = odgovorniLica;
+//    }
 }
Index: sources/app/src/main/java/parkup/entities/RegistriranParkirac.java
===================================================================
--- sources/app/src/main/java/parkup/entities/RegistriranParkirac.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/entities/RegistriranParkirac.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -51,4 +51,7 @@
     private String role;
 
+    @OneToOne
+    private ParkingSession session;
+
     private boolean locked;
 
@@ -58,4 +61,5 @@
         this.regTablicki = new ArrayList<Tablicka>();
         this.role = "ROLE_REGISTRIRAN_PARKIRAC";
+        session=null;
     }
 
@@ -69,4 +73,5 @@
         this.mobile = mobile;
         this.role = "ROLE_REGISTRIRAN_PARKIRAC";
+        session=null;
     }
 
@@ -79,4 +84,5 @@
         this.mobile = mobile;
         this.role = "ROLE_REGISTRIRAN_PARKIRAC";
+        session=null;
     }
 
@@ -88,5 +94,27 @@
         this.mobile = mobile;
         this.role = "ROLE_REGISTRIRAN_PARKIRAC";
-    }
+        session=null;
+    }
+
+    public ParkingSession getSession() {
+        return session;
+    }
+
+    public void setSession(ParkingSession session) {
+        this.session = session;
+    }
+
+    public boolean isLocked() {
+        return locked;
+    }
+
+    public void setLocked(boolean locked) {
+        this.locked = locked;
+    }
+
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+    }
+
 
     public int getRegParkId() {
Index: sources/app/src/main/java/parkup/entities/Vraboten.java
===================================================================
--- sources/app/src/main/java/parkup/entities/Vraboten.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/entities/Vraboten.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -4,4 +4,5 @@
 import org.springframework.security.core.userdetails.UserDetails;
 import parkup.data.VrabotenDemo;
+import parkup.data.enumarations.EmployeeStatus;
 
 import javax.persistence.*;
@@ -57,9 +58,12 @@
 
     @ManyToMany(cascade = {CascadeType.ALL})
-    @JoinColumn(name = "zona", nullable = false)
     private List<ParkingZone> parkingZones;
 
     @Column(name = "status")
-    private String status;
+    private EmployeeStatus status;
+
+    public void setLocked(boolean locked) {
+        this.locked = locked;
+    }
 
     @Column(name="locked")
@@ -73,6 +77,6 @@
         this.role = "ROLE_VRABOTEN";
         this.parkingZones = new ArrayList<ParkingZone>();
-        this.enabled = false;
-        this.status = "neRaboti";
+        this.enabled = true;
+        this.status = EmployeeStatus.NOT_WORKING;
     }
 
@@ -86,6 +90,6 @@
         this.parkingZones = parkingZones;
         this.role = "ROLE_VRABOTEN";
-        this.enabled = false;
-        this.status = "neRaboti";
+        this.enabled = true;
+        this.status = EmployeeStatus.NOT_WORKING;
     }
 
@@ -98,6 +102,6 @@
         this.parkingZones = parkingZones;
         this.role = "ROLE_VRABOTEN";
-        this.enabled = false;
-        this.status = "neRaboti";
+        this.enabled = true;
+        this.status = EmployeeStatus.NOT_WORKING;
     }
 
@@ -109,7 +113,7 @@
         this.mobile=mobile;
         this.parkingZones=new ArrayList<>();
-        this.enabled=false;
-        this.status="neRaboti";
         this.role="ROLE_VRABOTEN";
+        this.enabled=true;
+        this.status = EmployeeStatus.NOT_WORKING;
     }
 
@@ -204,7 +208,7 @@
     public void setParkingZones(List<ParkingZone> parkingZones) {this.parkingZones = parkingZones;}
 
-    public String getStatus() {return status;}
-
-    public void setStatus(String status) {this.status = status;}
+    public EmployeeStatus getStatus() {return status;}
+
+    public void setStatus(EmployeeStatus status) {this.status = status;}
 
     public boolean isAccount() {return enabled;}
Index: sources/app/src/main/java/parkup/repositories/ParkingSessionRepository.java
===================================================================
--- sources/app/src/main/java/parkup/repositories/ParkingSessionRepository.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/repositories/ParkingSessionRepository.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -4,8 +4,10 @@
 import parkup.entities.ParkingSession;
 
+import java.util.List;
+
 public interface ParkingSessionRepository extends JpaRepository<ParkingSession, Integer> {
 
     ParkingSession findByPssId(int parkingSessionId);
-
+    List<ParkingSession> findByParkingZonePzName(String pzName);
     void deleteByPssId(int parkingSessionId);
 }
Index: sources/app/src/main/java/parkup/repositories/ParkingSpaceRepository.java
===================================================================
--- sources/app/src/main/java/parkup/repositories/ParkingSpaceRepository.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/repositories/ParkingSpaceRepository.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -4,9 +4,9 @@
 import parkup.entities.ParkingSpace;
 
+import java.util.List;
+
 public interface ParkingSpaceRepository extends JpaRepository<ParkingSpace, Integer> {
     ParkingSpace findByPsName(String psName);
-
     ParkingSpace findByPsId(int parkingSpaceId);
-
     void deleteByPsId(int parkingSpaceId);
 }
Index: sources/app/src/main/java/parkup/repositories/ParkingZoneRepository.java
===================================================================
--- sources/app/src/main/java/parkup/repositories/ParkingZoneRepository.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/repositories/ParkingZoneRepository.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -3,5 +3,8 @@
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Repository;
+import parkup.entities.ParkingSpace;
 import parkup.entities.ParkingZone;
+
+import java.util.List;
 
 @Repository
@@ -10,5 +13,4 @@
 
     ParkingZone findByPzName(String name);
-
     void deleteByPzId(int id);
 }
Index: sources/app/src/main/java/parkup/repositories/TablickaRepository.java
===================================================================
--- sources/app/src/main/java/parkup/repositories/TablickaRepository.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
+++ sources/app/src/main/java/parkup/repositories/TablickaRepository.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -0,0 +1,8 @@
+package parkup.repositories;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import parkup.data.Tablicka;
+
+public interface TablickaRepository extends JpaRepository<Tablicka,Integer> {
+    Tablicka findByTablica(String tablica);
+}
Index: sources/app/src/main/java/parkup/services/AdministratorService.java
===================================================================
--- sources/app/src/main/java/parkup/services/AdministratorService.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/services/AdministratorService.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -137,21 +137,5 @@
 
         String token = UUID.randomUUID().toString();
-<<<<<<< HEAD
-//        ConfirmationTokenRP confirmationToken = new ConfirmationTokenRP(
-//                token,
-//                LocalDateTime.now(),
-//                LocalDateTime.now().plusMinutes(15),
-//                administrator
-//        );
-=======
-        //ConfirmationTokenRP confirmationToken = new ConfirmationTokenRP(
-        //        token,
-        //        LocalDateTime.now(),
-        //        LocalDateTime.now().plusMinutes(15),
-        //        administrator
-        //);
->>>>>>> 9504a097ce80831ea7e7130dff7215d5fbf8e939
 
-        //confirmationTokenService.saveConfirmationToken(confirmationToken);
 
         // TODO: SEND EMAIL
Index: sources/app/src/main/java/parkup/services/ParkingSessionService.java
===================================================================
--- sources/app/src/main/java/parkup/services/ParkingSessionService.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/services/ParkingSessionService.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -4,23 +4,42 @@
 import org.springframework.stereotype.Service;
 import parkup.data.Tablicka;
+import parkup.data.enumarations.SessionStatus;
 import parkup.entities.ParkingSession;
+import parkup.entities.ParkingSpace;
+import parkup.entities.ParkingZone;
 import parkup.repositories.ParkingSessionRepository;
+import parkup.repositories.ParkingSpaceRepository;
+import parkup.repositories.ParkingZoneRepository;
+import parkup.repositories.TablickaRepository;
 
 import javax.transaction.Transactional;
+import java.time.Duration;
+import java.time.LocalDateTime;
 import java.util.List;
-import java.util.Objects;
 import java.util.Optional;
+import java.util.stream.Collectors;
 
 @Service
 public class ParkingSessionService {
     private final ParkingSessionRepository parkingSessionRepository;
+    private final ParkingZoneRepository parkingZoneRepository;
+    private final ParkingSpaceRepository parkingSpaceRepository;
+    private final TablickaRepository tablickaRepository;
 
     @Autowired
-    public ParkingSessionService(ParkingSessionRepository parkingSessionRepository) {
+    public ParkingSessionService(ParkingSessionRepository parkingSessionRepository, ParkingZoneRepository parkingZoneRepository, ParkingSpaceRepository parkingSpaceRepository, TablickaRepository tablickaRepository) {
         this.parkingSessionRepository = parkingSessionRepository;
+        this.parkingZoneRepository = parkingZoneRepository;
+        this.parkingSpaceRepository = parkingSpaceRepository;
+        this.tablickaRepository = tablickaRepository;
     }
 
+    //TODO add getMethod for paid sessions or all sessions
+
     public List<ParkingSession> getAllParkingSessions() {
-        return parkingSessionRepository.findAll();
+        //Get all sessions that arent paid
+        return parkingSessionRepository.findAll().stream()
+                .filter(s->!s.getStatus().equals(SessionStatus.ENDED_PAID))
+                .collect(Collectors.toList());
     }
 
@@ -30,5 +49,5 @@
     }
 
-    @Transactional
+   /* @Transactional
     public void updateParkingSession(int parkingSessionId, String timeStart, String timeEnd, Tablicka tablicka) {
         Optional<ParkingSession> parkingSessionOpt = Optional.ofNullable(parkingSessionRepository.findByPssId(parkingSessionId));
@@ -48,9 +67,10 @@
             throw new IllegalStateException("The ParkingSession does not exist");
         }
-    }
-
+    }*/
+    @Transactional
     public Optional<ParkingSession> deleteParkingSession(int parkingSessionId) {
         Optional<ParkingSession> parkingSessionOpt = Optional.ofNullable(parkingSessionRepository.findByPssId(parkingSessionId));
         if (parkingSessionOpt.isPresent()) {
+            parkingSessionOpt.get().getParkingSpace().setTaken(false);
             parkingSessionRepository.deleteByPssId(parkingSessionId);
             return parkingSessionOpt;
@@ -60,13 +80,103 @@
     }
 
-    public Optional<ParkingSession> addParkingSession(ParkingSession parkingSession) {
-        Optional<ParkingSession> parkingSessionOpt = Optional.ofNullable(parkingSessionRepository.findByPssId(parkingSession.getPssId()));
-        if (parkingSessionOpt.isPresent()) {
-            throw new IllegalStateException("ID already taken, ParkingSession cannot be added");
-        } else {
-            System.out.println(parkingSession);
-            parkingSessionRepository.save(parkingSession);
-            return parkingSessionOpt;
+    @Transactional
+    public Optional<ParkingSession> startParkingSession(String tablica, int parkingZoneId) {
+        ParkingZone parkingZone = parkingZoneRepository.findByPzId(parkingZoneId);
+        Tablicka tablicka = tablickaRepository.findByTablica(tablica);
+        if(tablicka==null) {
+            tablickaRepository.save(new Tablicka(tablica));
         }
+        tablicka=tablickaRepository.findByTablica(tablica);
+        ParkingSession sessionToAdd = new ParkingSession(tablicka);
+        sessionToAdd.setParkingZone(parkingZone);
+        parkingSessionRepository.save(sessionToAdd);
+        return Optional.of(sessionToAdd);
+
+    }
+
+//    public void executePayment(int id){
+//        ParkingSession session = parkingSessionRepository.findByPssId(id);
+//        if(session==null){
+//            throw new IllegalStateException("No such session exists");
+//        }
+//        else if(session.getStatus()== SessionStatus.ENDED_UNPAID){
+//            throw new IllegalStateException("Cannot execute payment on an ended session");
+//        }
+//        session.setStatus(SessionStatus.ENDED_PAID);
+//    }
+
+    public int calculatePayment(int id){
+        ParkingSession session = parkingSessionRepository.findByPssId(id);
+        if(session==null){
+            throw new IllegalStateException("No such session exists");
+        }
+        else if(session.getStatus()== SessionStatus.ENDED_UNPAID){
+            throw new IllegalStateException("Cannot calculate payment on an ended session");
+        }
+        int price = session.getParkingZone().getPrice();
+        return (int) (Math.ceil(Duration.between(session.getTimeEnd(),session.getTimeStart()).toMinutes()/60.0)*price);
+    }
+    @Transactional
+    public ParkingSession verifyParkingSession(int id,String parkingSpaceName,int parkingZoneId){
+        ParkingSession parkingSession = parkingSessionRepository.findByPssId(id);
+        ParkingZone parkingZone = parkingZoneRepository.findByPzId(parkingZoneId);
+        if(parkingSession==null){
+            throw new IllegalStateException("No such session exists");
+        }
+        else if(parkingSession.getStatus()==SessionStatus.STARTED_VERIFIED){
+            throw new IllegalStateException("The session you are trying to verify has already been verified");
+        }
+//        else if(parkingSession.getStatus()!=SessionStatus.STARTED_)
+        if(!parkingZone.getParkingSpaces().contains(parkingSpaceRepository.findByPsName(parkingSpaceName))){
+            throw new IllegalStateException("Ivalid parking space inserted. Type in a new parking space or let the admin know that they should add the parking space to this zone");
+        }
+        parkingSession.setStatus(SessionStatus.STARTED_VERIFIED);
+        ParkingSpace parkingSpace = parkingZoneRepository.findByPzId(parkingZoneId).getParkingSpaces().stream().filter(ps->ps.getPsName().equals(parkingSpaceName)).findFirst().get();
+        parkingSpace.setTaken(true);
+        parkingSession.setParkingSpace(parkingSpace);
+        return parkingSession;
+    }
+    @Transactional
+    public ParkingSession endParkingSession(int id){
+        ParkingSession parkingSession = parkingSessionRepository.findByPssId(id);
+        if(parkingSession==null){
+            throw new IllegalStateException("No such session exists");
+        }
+        else if(parkingSession.getStatus()==SessionStatus.ENDED_UNPAID){
+            throw new IllegalStateException("The session you are trying to end has already been ended");
+        }
+        parkingSession.setStatus(SessionStatus.ENDED_UNPAID);
+        parkingSession.setTimeEnd(LocalDateTime.now());
+        return parkingSession;
+    }
+    @Transactional
+    public boolean payParkingSession(int id,String date){
+        ParkingSession parkingSession = parkingSessionRepository.findByPssId(id);
+        String expMonthString=date.split("/")[0];
+        String expYearString=date.split("/")[1];
+        if(expMonthString.startsWith("0"))
+            expMonthString=expYearString.substring(1);
+        if(expYearString.startsWith("0"))
+            expYearString=expYearString.substring(1);
+        int expMonth=Integer.parseInt(expMonthString);
+        int expYear=Integer.parseInt(expYearString);
+        int month = LocalDateTime.now().getMonth().getValue();
+        int year = LocalDateTime.now().getYear()%100;
+        if(year>expYear){
+            throw new IllegalStateException("Your card has expired or the date that you have entered is incorrect");
+        }
+        else if(year==expYear){
+            if(month>=expMonth)
+                throw new IllegalStateException("Your card has expired or the date that you have entered is incorrect");
+        }
+        if(parkingSession==null){
+            throw new IllegalStateException("No such session exists");
+        }
+        else if(parkingSession.getStatus()==SessionStatus.ENDED_PAID){
+            throw new IllegalStateException("The session has already been paid for");
+        }
+        parkingSession.setStatus(SessionStatus.ENDED_PAID);
+        parkingSession.getParkingSpace().setTaken(false);
+        return true;
     }
 }
Index: sources/app/src/main/java/parkup/services/ParkingSpaceService.java
===================================================================
--- sources/app/src/main/java/parkup/services/ParkingSpaceService.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/services/ParkingSpaceService.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -5,4 +5,5 @@
 import parkup.entities.ParkingSpace;
 import parkup.repositories.ParkingSpaceRepository;
+import parkup.repositories.ParkingZoneRepository;
 
 import javax.transaction.Transactional;
@@ -10,12 +11,15 @@
 import java.util.Objects;
 import java.util.Optional;
+import java.util.stream.Collectors;
 
 @Service
 public class ParkingSpaceService {
     private final ParkingSpaceRepository parkingSpaceRepository;
+    private final ParkingZoneRepository parkingZoneRepository;
 
     @Autowired
-    public ParkingSpaceService(ParkingSpaceRepository parkingSpaceRepository) {
+    public ParkingSpaceService(ParkingSpaceRepository parkingSpaceRepository, ParkingZoneRepository parkingZoneRepository) {
         this.parkingSpaceRepository = parkingSpaceRepository;
+        this.parkingZoneRepository = parkingZoneRepository;
     }
 
@@ -29,17 +33,17 @@
     }
 
-    public Optional<ParkingSpace> addParkingSpace(ParkingSpace parkingSpace) {
-        Optional<ParkingSpace> parkingSpaceOpt = Optional.ofNullable(parkingSpaceRepository.findByPsName(parkingSpace.getPsName()));
-        if (parkingSpaceOpt.isPresent()) {
-            throw new IllegalStateException("Name already taken, try adding a ParkingZone with a different name");
+    public Optional<ParkingSpace> addParkingSpace(ParkingSpace parkingSpace,int parkingZoneId) {
+        List<String> names = parkingZoneRepository.findByPzId(parkingZoneId).getParkingSpaces().stream().map(ParkingSpace::getPsName).collect(Collectors.toList());
+        if (names.contains(parkingSpace.getPsName())) {
+            throw new IllegalStateException("Name already taken, try adding a ParkingSpace with a different name");
         } else {
             System.out.println(parkingSpace);
             parkingSpaceRepository.save(parkingSpace);
         }
-        return parkingSpaceOpt;
+        return Optional.of(parkingSpace);
     }
 
     @Transactional
-    public ParkingSpace updateParkingSpace(int parkingSpaceId, String psName, boolean taken, boolean handicaped, float lat, float lng) {
+    public ParkingSpace updateParkingSpace(int parkingSpaceId, String psName, boolean taken, float lat, float lng) {
         Optional<ParkingSpace> ParkingSpaceOpt = Optional.ofNullable(parkingSpaceRepository.findByPsId(parkingSpaceId));
         if (ParkingSpaceOpt.isPresent()) {
@@ -58,7 +62,4 @@
             }
 
-            if (!Objects.equals(ParkingSpaceNov.isHandicaped(), handicaped)) {
-                ParkingSpaceNov.setHandicaped(handicaped);
-            }
 
             if(lat!=0 && !Objects.equals(ParkingSpaceNov.getLat(), lat)){
@@ -85,3 +86,6 @@
         return parkingSpaceOpt;
     }
+    public long getNumberOfTakenSpaces(){
+        return parkingSpaceRepository.findAll().stream().filter(ParkingSpace::isTaken).count();
+    }
 }
Index: sources/app/src/main/java/parkup/services/ParkingZoneService.java
===================================================================
--- sources/app/src/main/java/parkup/services/ParkingZoneService.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/services/ParkingZoneService.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -2,11 +2,14 @@
 
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.stereotype.Service;
 import parkup.data.ParkingZoneLocation;
+import parkup.entities.ParkingSession;
 import parkup.entities.ParkingSpace;
 import parkup.entities.ParkingZone;
 import parkup.entities.Vraboten;
+import parkup.repositories.ParkingSessionRepository;
+import parkup.repositories.ParkingSpaceRepository;
 import parkup.repositories.ParkingZoneRepository;
+import parkup.repositories.VrabotenRepository;
 
 import javax.transaction.Transactional;
@@ -19,8 +22,14 @@
 public class ParkingZoneService {
     private final ParkingZoneRepository parkingZoneRepository;
+    private final ParkingSpaceRepository parkingSpaceRepository;
+    private final VrabotenRepository vrabotenRepository;
+    private final ParkingSessionRepository parkingSessionRepository;
 
     @Autowired
-    public ParkingZoneService(ParkingZoneRepository parkingZoneRepository) {
+    public ParkingZoneService(ParkingZoneRepository parkingZoneRepository, ParkingSpaceRepository parkingSpaceRepository, VrabotenRepository vrabotenRepository, ParkingSessionRepository parkingSessionRepository) {
         this.parkingZoneRepository = parkingZoneRepository;
+        this.parkingSpaceRepository = parkingSpaceRepository;
+        this.parkingSessionRepository = parkingSessionRepository;
+        this.vrabotenRepository = vrabotenRepository;
     }
 
@@ -37,5 +46,5 @@
         List<ParkingZone> parkingZones = this.parkingZoneRepository.findAll();
         List<String> parkingZonesNames = new ArrayList<>();
-        for (ParkingZone pz : parkingZones){
+        for (ParkingZone pz : parkingZones) {
             parkingZonesNames.add(pz.getPzName());
         }
@@ -65,91 +74,88 @@
     }
 
-<<<<<<< HEAD
     //TODO proveri dali ima odgovorni i dokolku ima dali postojat vo bazata
     @Transactional
-    public ParkingZone updateParkingZone(int parkingZoneId, String pzName, int price, int capacity,
+    public ParkingZone updateParkingZone(int parkingZoneId, String pzName, int price,
                                          String location, int from, int to, String color,
-                                         List<ParkingSpace> parkingSpaces, ParkingZoneLocation parkingZoneLocation, List<Vraboten> odgovorniLica) {
+                                         List<ParkingSpace> parkingSpaces, ParkingZoneLocation parkingZoneLocation, List<Integer> odgovorniLica) {
 
-        for(ParkingSpace space:parkingSpaces){
-            System.out.println(space);
-        }
-        for(Vraboten v : odgovorniLica){
-            System.out.println(v.toString());
-        }
-=======
-    //TODO prati niza od objekti ParkingSpaces i prati objekt ParkingZoneLocation
-    @Transactional
-    public ParkingZone updateParkingZone(int parkingZoneId, String pzName, int price, int capacity,
-                                         String location, int from, int to, String color,
-                                         List<ParkingSpace> parkingSpaces, ParkingZoneLocation parkingZoneLocation) {
->>>>>>> 9504a097ce80831ea7e7130dff7215d5fbf8e939
-        Optional<ParkingZone> parkingZoneOpt = Optional.ofNullable(parkingZoneRepository.findByPzId(parkingZoneId));
-        if (parkingZoneOpt.isPresent()) {
+        //TODO prati niza od objekti ParkingSpaces i prati objekt ParkingZoneLocation
+
             ParkingZone parkingZoneNov = parkingZoneRepository.findByPzId(parkingZoneId);
-            if (pzName != null && pzName.length() > 1 && !Objects.equals(parkingZoneNov.getPzName(), pzName)) {
-                Optional<ParkingZone> parkingZoneOpt1 = Optional.ofNullable(parkingZoneRepository.findByPzName(pzName));
-                if (parkingZoneOpt1.isPresent()) {
-                    throw new IllegalStateException("There is already a ParkingZone with the same name");
+            if (parkingZoneNov!=null) {
+                if (pzName != null && pzName.length() > 1) { ;
+                    if (parkingZoneNov.getPzName().equals(pzName)&&parkingZoneNov.getId()!=parkingZoneId) {
+                        throw new IllegalStateException("There is already a ParkingZone with the same name");
+                    }
+
+                    parkingZoneNov.setPzName(pzName);
                 }
 
-                parkingZoneNov.setPzName(pzName);
+                if (price != 0 && !Objects.equals(parkingZoneNov.getPrice(), price)) {
+                    parkingZoneNov.setPrice(price);
+                }
+
+                if (location != null && location.length() > 0 && !Objects.equals(parkingZoneNov.getAddress(), location)) {
+                    parkingZoneNov.setAddress(location);
+                }
+
+                if (from != 0 && !Objects.equals(parkingZoneNov.getFrom(), from)) {
+                    parkingZoneNov.setFrom(from);
+                }
+
+                if (to != 0 && !Objects.equals(parkingZoneNov.getTo(), to)) {
+                    parkingZoneNov.setTo(to);
+                }
+
+                if (color != null && color.length() > 0 && !Objects.equals(parkingZoneNov.getColor(), color)) {
+                    parkingZoneNov.setColor(color);
+                }
+
+                if (parkingZoneLocation != null) {
+                    parkingZoneNov.setParkingZoneLocation(parkingZoneLocation);
+                }
+
+                if (!parkingSpaces.isEmpty()) {
+                    ParkingZone parkingZone = parkingZoneRepository.findByPzId(parkingZoneId);
+//                    for(ParkingSpace space :parkingZone.getParkingSpaces()){
+//                        if(!parkingSpaces.contains(space)){
+//                            for(ParkingSession session: parkingSessionRepository.findByParkingZonePzName(pzName)){
+//                                if(session.getParkingSpace().getPsId()==space.getPsId())
+//                                    throw new IllegalStateException("Vlegov vo iffot");
+//                            }
+//                        }
+//                    }
+                    //TODO: treba da se opravi 
+                    parkingZone.setParkingSpaces(null);
+                    List<ParkingSpace> spacesToAdd = new ArrayList<>(parkingSpaces);
+                    parkingZone.setParkingSpaces(spacesToAdd);
+                }
+                if (!odgovorniLica.isEmpty()) {
+                    ParkingZone parkingZone = parkingZoneRepository.findByPzId(parkingZoneId);
+                    for (Integer vrabotenId : odgovorniLica) {
+                        Vraboten vrabotenToAdd = vrabotenRepository.findByVrabotenId(vrabotenId);
+                        if(vrabotenToAdd!=null)
+                        vrabotenToAdd.getParkingZones().add(parkingZone);
+                    }
+                }
+
+
+                return parkingZoneNov;
+            } else {
+                throw new IllegalStateException("There ParkingZone does not exist");
             }
+        }
 
-            if (price != 0 && !Objects.equals(parkingZoneNov.getPrice(), price)) {
-                parkingZoneNov.setPrice(price);
+
+        @Transactional
+        public Optional<ParkingZone> deleteParkingZone ( int parkingZoneId){
+            Optional<ParkingZone> parkingZoneOpt = Optional.ofNullable(parkingZoneRepository.findByPzId(parkingZoneId));
+            if (parkingZoneOpt.isPresent()) {
+                parkingZoneRepository.deleteByPzId(parkingZoneId);
+            } else {
+                throw new IllegalStateException("ParkingZone doesn't exist, therefore can't be deleted");
             }
-
-            if (capacity != 0 && !Objects.equals(parkingZoneNov.getCapacity(), capacity)) {
-                parkingZoneNov.setCapacity(capacity);
-            }
-
-            if (location != null && location.length() > 0 && !Objects.equals(parkingZoneNov.getLocation(), location)) {
-                parkingZoneNov.setLocation(location);
-            }
-
-            if (from != 0 && !Objects.equals(parkingZoneNov.getFrom(), from)) {
-                parkingZoneNov.setFrom(from);
-            }
-
-            if (to != 0 && !Objects.equals(parkingZoneNov.getTo(), to)) {
-                parkingZoneNov.setTo(to);
-            }
-
-            if (color != null && color.length() > 0 && !Objects.equals(parkingZoneNov.getColor(), color)) {
-                parkingZoneNov.setColor(color);
-            }
-
-            if(parkingZoneLocation!=null){
-                parkingZoneNov.setParkingZoneLocation(parkingZoneLocation);
-            }
-
-            if(!parkingSpaces.isEmpty()){
-                //TODO kreiraj lista od parkingSpaces, ni gi prakja false isHandicaped i isTaken
-                parkingZoneNov.setParkingSpaces(parkingSpaces);
-            }
-<<<<<<< HEAD
-            if(!odgovorniLica.isEmpty()){
-
-                parkingZoneNov.setOdgovorniLica(odgovorniLica);
-            }
-=======
->>>>>>> 9504a097ce80831ea7e7130dff7215d5fbf8e939
-
-            return parkingZoneNov;
-        } else {
-            throw new IllegalStateException("There ParkingZone does not exist");
+            return parkingZoneOpt;
         }
     }
 
-    @Transactional
-    public Optional<ParkingZone> deleteParkingZone(int parkingZoneId) {
-        Optional<ParkingZone> parkingZoneOpt = Optional.ofNullable(parkingZoneRepository.findByPzId(parkingZoneId));
-        if (parkingZoneOpt.isPresent()) {
-            parkingZoneRepository.deleteByPzId(parkingZoneId);
-        } else {
-            throw new IllegalStateException("ParkingZone doesn't exist, therefore can't be deleted");
-        }
-        return parkingZoneOpt;
-    }
-}
Index: sources/app/src/main/java/parkup/services/VrabotenService.java
===================================================================
--- sources/app/src/main/java/parkup/services/VrabotenService.java	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/java/parkup/services/VrabotenService.java	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -3,7 +3,7 @@
 import java.time.LocalDateTime;
 import java.util.*;
+import java.util.stream.Collectors;
 import javax.transaction.Transactional;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.security.core.userdetails.UserDetailsService;
@@ -13,5 +13,8 @@
 import parkup.configs.token.ConfirmationTokenW;
 import parkup.configs.token.ConfirmationTokenService;
+import parkup.data.enumarations.EmployeeStatus;
+import parkup.entities.ParkingZone;
 import parkup.entities.Vraboten;
+import parkup.repositories.ParkingZoneRepository;
 import parkup.repositories.VrabotenRepository;
 import parkup.data.VrabotenDemo;
@@ -20,10 +23,12 @@
 public class VrabotenService implements UserDetailsService {
     private final VrabotenRepository vrabotenRepository;
+    private final ParkingZoneRepository parkingZoneRepository;
     private final BCryptPasswordEncoder bCryptPasswordEncoder;
     private final ConfirmationTokenService confirmationTokenService;
 
     @Autowired
-    public VrabotenService(VrabotenRepository vrabotenRepository, BCryptPasswordEncoder bCryptPasswordEncoder, ConfirmationTokenService confirmationTokenService) {
+    public VrabotenService(VrabotenRepository vrabotenRepository, ParkingZoneRepository parkingZoneRepository, BCryptPasswordEncoder bCryptPasswordEncoder, ConfirmationTokenService confirmationTokenService) {
         this.vrabotenRepository = vrabotenRepository;
+        this.parkingZoneRepository = parkingZoneRepository;
         this.bCryptPasswordEncoder = bCryptPasswordEncoder;
         this.confirmationTokenService = confirmationTokenService;
@@ -43,5 +48,5 @@
         List<VrabotenDemo> vrabotenDemos = new ArrayList<>();
         for (Vraboten v : vraboteni){
-            VrabotenDemo vd = new VrabotenDemo(v.getFirstName(), v.getLastName(), v.getEmail());
+            VrabotenDemo vd = new VrabotenDemo(v.getVrabotenId(),v.getFirstName(), v.getLastName(), v.getEmail());
             vrabotenDemos.add(vd);
         }
@@ -49,56 +54,128 @@
     }
 
-    public Optional<Vraboten> addVraboten(Vraboten vraboten) {
-        Optional<Vraboten> vrabotenOpt = this.vrabotenRepository.findVrabotenByEmail(vraboten.getEmail());
-        if (vrabotenOpt.isPresent()) {
-            throw new IllegalStateException("Email already taken, try adding a vraboten with a different valid email address");
+    public Optional<Vraboten> addVraboten(String password,String confirmPass,boolean locked, String firstName, String lastName, String mobile, String email, EmployeeStatus status,List<String> parkingZones) {
+        Optional<Vraboten> vrabotenOpt = this.vrabotenRepository.findVrabotenByEmail(email);
+        if (vrabotenOpt.isPresent()){
+            throw new IllegalArgumentException("User with that mail already exists");
+        }
+        Vraboten vrabotenToAdd=new Vraboten();
+        if (email != null && email.length() > 1 && email.contains("@") ) {
+            vrabotenToAdd.setEmail(email);
         } else {
-            if (vraboten.getEmail() != null && vraboten.getEmail().length() > 1 && vraboten.getEmail().contains("@")) {
-                //System.out.println(vraboten);
-                this.vrabotenRepository.save(vraboten);
-            }
-            else{
-                throw new IllegalStateException("email not valid");
-            }
-        }
-        return vrabotenOpt;
+            throw new IllegalStateException("email not valid");
+        }
+        if(password.equals(confirmPass)){
+            vrabotenToAdd.setPassword(bCryptPasswordEncoder.encode(password));
+        }
+        vrabotenToAdd.setLocked(locked);
+
+        if (firstName != null && firstName.length() > 1) {
+            vrabotenToAdd.setFirstName(firstName);
+        }
+
+        if (lastName != null && lastName.length() > 1 ) {
+            vrabotenToAdd.setLastName(lastName);
+        }
+
+        if (mobile != null && mobile.length() > 0 ) {
+            vrabotenToAdd.setMobile(mobile);
+        }
+
+        vrabotenToAdd.setStatus(status);
+
+        if(parkingZones!=null){
+            List<ParkingZone> parkingZonesAvailable =parkingZoneRepository.findAll();
+            List<ParkingZone> zonesToAdd= new ArrayList<>();
+            vrabotenToAdd.setParkingZones(null);
+            for(String pzName:parkingZones){
+                for(ParkingZone pz :parkingZonesAvailable){
+                    if(pzName.equals(pz.getPzName())) {
+                        zonesToAdd.add(pz);
+//                            pz.getOdgovorniLica().add(vrabotenRepository.findByVrabotenId(vrabotenId));
+                    }
+                }
+            }
+            vrabotenToAdd.setParkingZones(zonesToAdd);
+        }
+        String token = UUID.randomUUID().toString();
+        ConfirmationTokenW confirmationTokenW = new ConfirmationTokenW(
+                token,
+                LocalDateTime.now(),
+                LocalDateTime.now().plusMinutes(15),
+                vrabotenToAdd
+        );
+
+        confirmationTokenService.saveConfirmationTokenW(confirmationTokenW);
+
+        return Optional.of(vrabotenToAdd);
+//        Optional<Vraboten> vrabotenOpt = this.vrabotenRepository.findVrabotenByEmail(vraboten.getEmail());
+//        if (vrabotenOpt.isPresent()) {
+//            throw new IllegalStateException("Email already taken, try adding a vraboten with a different valid email address");
+//        } else {
+//            if (vraboten.getEmail() != null && vraboten.getEmail().length() > 1 && vraboten.getEmail().contains("@")) {
+//                //System.out.println(vraboten);
+//                this.vrabotenRepository.save(vraboten);
+//            }
+//            else{
+//                throw new IllegalStateException("email not valid");
+//            }
+//        }
+//        return vrabotenOpt;
     }
 
     @Transactional
-    public Vraboten updateVraboten(int vrabotenId, String firstName, String lastName, String mobile, String email, String status) {
+    public Vraboten updateVraboten(int vrabotenId,String password,String confirmPass,boolean locked, String firstName, String lastName, String mobile, String email, EmployeeStatus status,List<String> parkingZones) {
         Optional<Vraboten> vrabotenOpt = Optional.ofNullable(this.vrabotenRepository.findByVrabotenId(vrabotenId));
         if (vrabotenOpt.isPresent()) {
-            Vraboten vrabotenNov = this.vrabotenRepository.findByVrabotenId(vrabotenId);
-            if (email != null && email.length() > 1 && email.contains("@") && !Objects.equals(vrabotenNov.getEmail(), email)) {
-                Optional<Vraboten> userOpt1 = this.vrabotenRepository.findVrabotenByEmail(email);
-                if (userOpt1.isPresent()) {
+
+            if (email != null && email.length() > 1 && email.contains("@") ) {
+                List<String> emails = vrabotenRepository.findAll().stream().map(Vraboten::getEmail).collect(Collectors.toList());
+                for(String mailToCheck :emails)
+                if (email.equals(mailToCheck)&&vrabotenOpt.get().getVrabotenId()!=vrabotenId) {
                     throw new IllegalStateException("email taken");
                 }
-                vrabotenNov.setEmail(email);
+                vrabotenOpt.get().setEmail(email);
             } else {
                 throw new IllegalStateException("email not valid");
             }
-
-            if (firstName != null && firstName.length() > 1 && !Objects.equals(vrabotenNov.getFirstName(), firstName)) {
-                vrabotenNov.setFirstName(firstName);
-            }
-
-            if (lastName != null && lastName.length() > 1 && !Objects.equals(vrabotenNov.getLastName(), lastName)) {
-                vrabotenNov.setLastName(lastName);
-            }
-
-            if (mobile != null && mobile.length() > 0 && !Objects.equals(vrabotenNov.getMobile(), mobile)) {
-                vrabotenNov.setMobile(mobile);
-            }
-
-            if (mobile != null && status.length() > 0 && !Objects.equals(vrabotenNov.getStatus(), status)) {
-                if(status.equals("raboti") || status.equals("ne raboti") || status.equals("na odmor") || status.equals("na boleduvanje")){
-                    vrabotenNov.setStatus(status);
-                }else{
-                    throw new IllegalStateException("Please enter one of the following statuses: 'raboti', 'ne raboti', 'na odmor', 'na boleduvanje'");
+            if(password.equals(confirmPass)){
+                vrabotenOpt.get().setPassword(bCryptPasswordEncoder.encode(password));
+            }
+            vrabotenOpt.get().setLocked(locked);
+
+            if (firstName != null && firstName.length() > 1 && !Objects.equals(vrabotenOpt.get().getFirstName(), firstName)) {
+                vrabotenOpt.get().setFirstName(firstName);
+            }
+
+            if (lastName != null && lastName.length() > 1 && !Objects.equals(vrabotenOpt.get().getLastName(), lastName)) {
+                vrabotenOpt.get().setLastName(lastName);
+            }
+
+            if (mobile != null && mobile.length() > 0 && !Objects.equals(vrabotenOpt.get().getMobile(), mobile)) {
+                vrabotenOpt.get().setMobile(mobile);
+            }
+
+//            if (status != null && status.toString().length() > 0) {
+//                if(Arrays.stream(EmployeeStatus.values()).toList().contains(EmployeeStatus.valueOf(status))){
+            vrabotenOpt.get().setStatus(status);
+//                }else{
+//                    throw new IllegalStateException("Please enter one of the following statuses: 'raboti', 'ne raboti', 'na odmor', 'na boleduvanje'");
+//                }
+//            }
+            if(parkingZones!=null){
+                List<ParkingZone> parkingZonesAvailable =parkingZoneRepository.findAll();
+                List<ParkingZone> zonesToAdd= new ArrayList<>();
+                vrabotenOpt.get().setParkingZones(null);
+                for(String pzName:parkingZones){
+                    for(ParkingZone pz :parkingZonesAvailable){
+                        if(pzName.equals(pz.getPzName())) {
+                            zonesToAdd.add(pz);
+//                            pz.getOdgovorniLica().add(vrabotenRepository.findByVrabotenId(vrabotenId));
+                        }
+                    }
                 }
-            }
-
-            return vrabotenNov;
+                vrabotenOpt.get().setParkingZones(zonesToAdd);
+            }
+            return vrabotenOpt.get();
         }
         else{
@@ -107,10 +184,8 @@
     }//za menjanje password da se implementira
 
-    @Modifying
     @Transactional
     public Optional<Vraboten> deleteVraboten(int vrabotenId) {
         Optional<Vraboten> vrabotenOpt = Optional.ofNullable(this.vrabotenRepository.findByVrabotenId(vrabotenId));
         if (vrabotenOpt.isPresent()) {
-            //TODO da povikamo metod od ConfirmationTokenService za brisenje na ConfirmationTokenW
             this.confirmationTokenService.deleteByVraboten_VrabotenId(vrabotenId);
             this.vrabotenRepository.deleteByVrabotenId(vrabotenId);
@@ -129,5 +204,5 @@
             throw new IllegalStateException("Vraboten doesn't exist, therefore his account can't be locked/unlocked");
         }
-    }//dali treba da stoi @Transactional gore nad funkcijata?
+    }
 
     @Override
@@ -176,3 +251,13 @@
     }
 
+//    @Transactional
+//    public void setVrabotenStatus(int vrabotenId,String vrabotenStatus) {
+//        Vraboten vraboten = vrabotenRepository.findByVrabotenId(vrabotenId);
+//        if(vraboten!=null && value){
+//            vraboten.setStatus(valuee);
+//        }
+//        else {
+//            throw new IllegalStateException(String.format("Vraboten with id %d does not exist.",vrabotenId));
+//        }
+//    }
 }
Index: sources/app/src/main/resources/application.properties
===================================================================
--- sources/app/src/main/resources/application.properties	(revision 2ace8f05cb6199d05ce30472306247199bdbfa30)
+++ sources/app/src/main/resources/application.properties	(revision 9ff45d65e1d0058eb0c79395ba62a726630c2daa)
@@ -2,5 +2,5 @@
 spring.datasource.username=postgres
 spring.datasource.password=1234
-spring.jpa.hibernate.ddl-auto=create-drop
+spring.jpa.hibernate.ddl-auto=update
 spring.jpa.show-sql=true
 spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
