diff --git a/src/main/java/org/springframework/samples/petclinic/employer/Employer.java b/src/main/java/org/springframework/samples/petclinic/employer/Employer.java new file mode 100644 index 000000000..72ad3b5e5 --- /dev/null +++ b/src/main/java/org/springframework/samples/petclinic/employer/Employer.java @@ -0,0 +1,28 @@ +package org.springframework.samples.petclinic.employer; + +public class Employer { + private String name; + private double salarie; + + public Employer(String name, double salarie) { + this.name = name; + this.salarie = salarie; + } + + public double getSalarie() { + return salarie; + } + + public void setSalarie(double salarie) { + this.salarie = salarie; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} diff --git a/src/main/java/org/springframework/samples/petclinic/employer/EmployerController.java b/src/main/java/org/springframework/samples/petclinic/employer/EmployerController.java new file mode 100644 index 000000000..99221c708 --- /dev/null +++ b/src/main/java/org/springframework/samples/petclinic/employer/EmployerController.java @@ -0,0 +1,28 @@ +package org.springframework.samples.petclinic.employer; + + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +import java.util.ArrayList; +import java.util.List; + + +@Controller +public class EmployerController{ + + @GetMapping("/employers") + public String showEmployerList(Model model){ + List emplo = new ArrayList(); + model.addAttribute("employers",emplo); + emplo.add(new Employer("Geio",2900)); + emplo.add(new Employer("Poua",5000)); + emplo.add(new Employer("Heijo",3500)); + emplo.add(new Employer("Reina",7502)); + emplo.add(new Employer("Ghest",4500)); + emplo.add(new Employer("Undermetal",2900)); + emplo.add(new Employer("Rolando",2900)); + return "employers/employersList"; + } +} diff --git a/src/main/java/org/springframework/samples/petclinic/product/Product.java b/src/main/java/org/springframework/samples/petclinic/product/Product.java index 0ce2e1f06..e2590dca3 100644 --- a/src/main/java/org/springframework/samples/petclinic/product/Product.java +++ b/src/main/java/org/springframework/samples/petclinic/product/Product.java @@ -1,12 +1,18 @@ package org.springframework.samples.petclinic.product; -public class Product { +import org.springframework.samples.petclinic.model.BaseEntity; + +import javax.persistence.Entity; +import javax.persistence.Table; + +@Entity +@Table(name = "products") +public class Product extends BaseEntity { private String description; - Product(String desc){ - this.description = desc; - } public String getDescription() { return description; } + + public void setDescription(String description) { this.description = description; } } diff --git a/src/main/java/org/springframework/samples/petclinic/product/ProductController.java b/src/main/java/org/springframework/samples/petclinic/product/ProductController.java index 404457d97..d31f73c47 100644 --- a/src/main/java/org/springframework/samples/petclinic/product/ProductController.java +++ b/src/main/java/org/springframework/samples/petclinic/product/ProductController.java @@ -6,18 +6,23 @@ import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import java.util.ArrayList; +import java.util.Collection; import java.util.List; @Controller public class ProductController { + private final ProductRepository products; + + public ProductController(ProductRepository products){ + this.products = products; + } + @GetMapping("/products") public String showProductList(Model model){ - List prods = new ArrayList(); + Collection prods = products.findAll(); model.addAttribute("products",prods); - prods.add(new Product("Aninha")); - prods.add(new Product("Leozinho")); return "products/productsList"; } } diff --git a/src/main/java/org/springframework/samples/petclinic/product/ProductRepository.java b/src/main/java/org/springframework/samples/petclinic/product/ProductRepository.java new file mode 100644 index 000000000..a25d105f4 --- /dev/null +++ b/src/main/java/org/springframework/samples/petclinic/product/ProductRepository.java @@ -0,0 +1,11 @@ +package org.springframework.samples.petclinic.product; + + +import org.springframework.dao.DataAccessException; +import org.springframework.data.repository.Repository; + +import java.util.Collection; + +public interface ProductRepository extends Repository { + Collection findAll() throws DataAccessException; +} diff --git a/src/main/less/header.less b/src/main/less/header.less index 7cb1a7888..c5e3c22f3 100644 --- a/src/main/less/header.less +++ b/src/main/less/header.less @@ -1,6 +1,6 @@ .navbar { border-top: 4px solid #6db33f; - background-color: #34302d; + background-color: #838789; margin-bottom: 0px; border-bottom: 0; border-left: 0; @@ -55,7 +55,7 @@ margin-bottom: 0; } .navbar li:hover > a { - color: #eeeeee; + color: #bbbbbb; background-color: #6db33f; } diff --git a/src/main/less/petclinic.less b/src/main/less/petclinic.less index 7c88ec091..289eb6789 100644 --- a/src/main/less/petclinic.less +++ b/src/main/less/petclinic.less @@ -18,6 +18,8 @@ @spring-brown: #34302D; @spring-grey: #838789; @spring-light-grey: #f1f1f1; +@spring-purple: #322d34; +@spring-red: #ff1235; @body-bg: @spring-light-grey; @text-color: @spring-brown; @@ -51,16 +53,16 @@ .table > thead > tr > th { background-color: lighten(@spring-brown, 3%); - color: @spring-light-grey; + color: @spring-red; } .table-filter { - background-color: @spring-brown; + background-color: @spring-purple; padding: 9px 12px; } .nav > li > a { - color: @spring-grey; + color: @spring-red; } .btn-default { @@ -76,7 +78,7 @@ &:active, &.active, .open .dropdown-toggle& { - background-color: @spring-brown; + background-color: @spring-purple; border-color: @spring-brown; } } @@ -125,7 +127,7 @@ h1 { } .splash { - background: @spring-green; + background: @spring-brown; color: @spring-brown; display: none; } diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt index 6225d1208..de4771add 100644 --- a/src/main/resources/banner.txt +++ b/src/main/resources/banner.txt @@ -1,15 +1,11 @@ +ᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᘉƗᑕᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᘉƗᑕᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᘉƗᑕᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᘉƗᑕᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᘉƗᑕᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᘉƗᑕ + +ᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᘉƗᑕᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᘉƗᑕᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᘉƗᑕvᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᘉƗᑕ +ᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᘉƗᑕ +ᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᘉƗᑕvᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᘉƗᑕv +vᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᘉƗᑕ +ᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᘉƗᑕ +ᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᘉƗᑕ - |\ _,,,--,,_ - /,`.-'`' ._ \-;;,_ - _______ __|,4- ) )_ .;.(__`'-'__ ___ __ _ ___ _______ - | | '---''(_/._)-'(_\_) | | | | | | | | | - | _ | ___|_ _| | | | | |_| | | | __ _ _ - | |_| | |___ | | | | | | | | | | \ \ \ \ - | ___| ___| | | | _| |___| | _ | | _| \ \ \ \ - | | | |___ | | | |_| | | | | | | |_ ) ) ) ) - |___| |_______| |___| |_______|_______|___|_| |__|___|_______| / / / / - ==================================================================/_/_/_/ - -:: Built with Spring Boot :: ${spring-boot.version} - +ᘉƗᑕᗰᗩƬᕼᕮᑌᔕ ᑭᕮƬᑕᒪƗᘉƗᑕ diff --git a/src/main/resources/db/hsqldb/data.sql b/src/main/resources/db/hsqldb/data.sql index 16dda3e84..2ca703500 100644 --- a/src/main/resources/db/hsqldb/data.sql +++ b/src/main/resources/db/hsqldb/data.sql @@ -51,3 +51,11 @@ INSERT INTO visits VALUES (1, 7, '2013-01-01', 'rabies shot'); INSERT INTO visits VALUES (2, 8, '2013-01-02', 'rabies shot'); INSERT INTO visits VALUES (3, 8, '2013-01-03', 'neutered'); INSERT INTO visits VALUES (4, 7, '2013-01-04', 'spayed'); + +INSERT INTO products VALUES (1,'produto P1'); +INSERT INTO products VALUES (2,'produto P2'); +INSERT INTO products VALUES (3,'produto P3'); +INSERT INTO products VALUES (4,'produto P4'); +INSERT INTO products VALUES (5,'produto P5'); + + diff --git a/src/main/resources/db/hsqldb/schema.sql b/src/main/resources/db/hsqldb/schema.sql index f3c6947b7..0fbfa6dc1 100644 --- a/src/main/resources/db/hsqldb/schema.sql +++ b/src/main/resources/db/hsqldb/schema.sql @@ -5,6 +5,7 @@ DROP TABLE visits IF EXISTS; DROP TABLE pets IF EXISTS; DROP TABLE types IF EXISTS; DROP TABLE owners IF EXISTS; +DROP TABLE products IF EXISTS; CREATE TABLE vets ( @@ -62,3 +63,8 @@ CREATE TABLE visits ( ); ALTER TABLE visits ADD CONSTRAINT fk_visits_pets FOREIGN KEY (pet_id) REFERENCES pets (id); CREATE INDEX visits_pet_id ON visits (pet_id); + +CREATE TABLE products ( + id INTEGER IDENTITY PRIMARY KEY, + description VARCHAR(80) +); diff --git a/src/main/resources/templates/employers/employersList.html b/src/main/resources/templates/employers/employersList.html new file mode 100644 index 000000000..1dea04f7c --- /dev/null +++ b/src/main/resources/templates/employers/employersList.html @@ -0,0 +1,25 @@ + + + + + + + Employers List +

Employers List

+ + + + + + + + + + + + + + + + diff --git a/src/main/resources/templates/error.html b/src/main/resources/templates/error.html index b9026690e..28c3b9916 100644 --- a/src/main/resources/templates/error.html +++ b/src/main/resources/templates/error.html @@ -3,9 +3,9 @@ - -

Something happened...

-

Exception message

+ +

Oh shit...

+

Deu ruim manito!!!!

- \ No newline at end of file + diff --git a/src/main/resources/templates/fragments/layout.html b/src/main/resources/templates/fragments/layout.html index b602a3929..7d6243f2d 100755 --- a/src/main/resources/templates/fragments/layout.html +++ b/src/main/resources/templates/fragments/layout.html @@ -64,6 +64,11 @@ Products +
  • + + Employers +
  • +
  • Error diff --git a/src/main/resources/templates/welcome.html b/src/main/resources/templates/welcome.html index 4fa1cd328..1084b71bf 100644 --- a/src/main/resources/templates/welcome.html +++ b/src/main/resources/templates/welcome.html @@ -4,13 +4,16 @@ -

    Welcome

    +

    Welcome

    - + +
    +
    +
    - \ No newline at end of file +
  • NamesSalaries