From 4a279906268dc5f9a26c4c9dd59e41e77619f289 Mon Sep 17 00:00:00 2001 From: abazov73 <92822431+abazov73@users.noreply.github.com> Date: Tue, 2 May 2023 01:29:14 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=8F=D1=82=D0=B0=D1=8F=20=D0=BB=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0.=20=D0=9D=D0=B0=D1=87?= =?UTF-8?q?=D0=B0=D0=BB=D0=B0=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20?= =?UTF-8?q?=D1=81=20MVC=20+=20CustomerMVCController.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/ipLab/build.gradle | 7 + backend/ipLab/data.mv.db | Bin 77824 -> 126976 bytes .../Controllers/CustomerController.java | 16 +- .../Controllers/OrderedController.java | 14 +- .../Controllers/ProductController.java | 12 +- .../Controllers/StoreController.java | 20 +- .../ipLab/StoreDataBase/DTO/CustomerDTO.java | 39 ++- .../ipLab/StoreDataBase/DTO/OrderedDTO.java | 26 +- .../ipLab/StoreDataBase/DTO/ProductDTO.java | 9 +- .../ipLab/StoreDataBase/DTO/StoreDTO.java | 10 +- .../MVC/CustomerMVCController.java | 63 ++++ .../util/error/AdviceController.java | 3 +- .../com/example/ipLab/WebConfiguration.java | 1 + .../main/resources/public/css/styleSite.css | 284 ++++++++++++++++++ .../src/main/resources/public/favicon.ico | Bin 0 -> 1150 bytes .../resources/templates/customer-edit.html | 35 +++ .../main/resources/templates/customer.html | 55 ++++ .../src/main/resources/templates/default.html | 47 +++ .../src/main/resources/templates/error.html | 13 + .../src/main/resources/templates/index.html | 13 + .../src/components/common/customerTable.jsx | 13 +- frontend/src/components/common/orderTable.jsx | 9 +- .../src/components/common/productTable.jsx | 7 +- frontend/src/components/common/storeTable.jsx | 7 +- .../src/components/pages/addToStorePage.jsx | 8 +- frontend/src/services/DataService.js | 7 +- 26 files changed, 645 insertions(+), 73 deletions(-) create mode 100644 backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/MVC/CustomerMVCController.java create mode 100644 backend/ipLab/src/main/resources/public/css/styleSite.css create mode 100644 backend/ipLab/src/main/resources/public/favicon.ico create mode 100644 backend/ipLab/src/main/resources/templates/customer-edit.html create mode 100644 backend/ipLab/src/main/resources/templates/customer.html create mode 100644 backend/ipLab/src/main/resources/templates/default.html create mode 100644 backend/ipLab/src/main/resources/templates/error.html create mode 100644 backend/ipLab/src/main/resources/templates/index.html diff --git a/backend/ipLab/build.gradle b/backend/ipLab/build.gradle index dec8f5c..292d83d 100644 --- a/backend/ipLab/build.gradle +++ b/backend/ipLab/build.gradle @@ -23,6 +23,13 @@ dependencies { testImplementation 'org.springframework.boot:spring-boot-starter-test' implementation 'org.hibernate.validator:hibernate-validator' + + implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' + implementation 'org.springframework.boot:spring-boot-devtools' + implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect' + implementation 'org.webjars:bootstrap:5.1.3' + implementation 'org.webjars:jquery:3.6.0' + implementation 'org.webjars:font-awesome:6.1.0' } tasks.named('test') { diff --git a/backend/ipLab/data.mv.db b/backend/ipLab/data.mv.db index af21ef00a86be28277439e244c158446ad16140c..49988c5907a130395b449269252a5bf7217d9093 100644 GIT binary patch literal 126976 zcmeHw4VWEOnP%Ni-*gf3GmC;TByeedqitLNRp&BlI^8!(C*7T-`*uin_Sv5LMV6#H z>FywiK!OYS=mr@s2mSEtVRo%j3Brn1)K?Vj?lEL&_pcE!8HvZ^RbkN?j7 zlUJ6tQ0?)jLw7a|%Bo`pk!A#;AN532(|g=mTzyqIJ#)p>WLz-X9nSji45!Oh;24T+ zn@gnpmvbQJK+b`j133qB4&)rjIgoQ8=RnSZoC7%rat@qy4s6Qx|C8P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@_3`dryhYVy& z2pxRvQD|$ZuxBsZ@Thor<01P>Cg?f6p_kLWP=b47ADu$$Z4p22c2s`HkVekgE zMX3=U9l&H9|M|H*qg9`&?%Sym^ToPD~e{LEG z@9BU{{B#FiRWg8-yVMCsj^h6D`>s2PC+023e<_47Jc_?DvF%NKFjs0@wCs2u*h}q6 z+#fEy3^;%i>f-|B!I)BX%oUSFgH%5Ue2<3*>DQ# zWh_Gi1fns{56A|bAKDr!?Tgfn^!giz?BP;`Y$;G>F(=V99t~VKNRjPZG@+kDR7S{l z+7g>&a#u<>0pqT`3MM<43nGZy50Ay9%>Ky;;=txW4R&tm`jtH^R-8=A9Qkib8GyH0 zFQcC^cx#47R%6?{gUv8${MdU>l*YS1-j0FS&AFrVrTk}$q4O3LW{RQSpB86|q27;L zA~DoEyL4hP)VoF!VyO2I2CT7Plnle3_Fg<&^ z7&77#M9pHO(mZoISv-i?L5y?g3=UswMzR zKoqW?iW`@4^(6h{2v<+#B8VYSPvwOLXltl^KA;h(r}9OJi>ESK5B4M~v#P+gpq|Rt zK}S$eW&bc70ekq3xY#BHu}M=7KDCOfMO9QPdqC-^ttq*>_|J_AQKveT!}p z`xZtM_6;sa8P_AoRUllYC%(sBFTKEA4))J~$y~1?>F5~uz4ZG@?tAHNpv2&N=~J+o z>+{f&xqjYvVPLR3A3kJTg2t!0D|Moi(s<8+Wap>JZpfAeyg-SLy*-Gl8KQz`$CYrR zPAi4;HIzA3h!+utRxBr7Js6woM%DEp>wQfy`x~RQ_Z-YTTfqaHSMZ=cl?om(`w#y& znEk6~m)XB{#>^fvadCa;a3OvNlD_%Kl-iO!6HL!D$<8^OMK?O7`joPuOf<7J^HKuv z30dQ_C{L}bZTSp6nRx-jcVT2_F+E6kCWu$QGpAMXga2ri?LhL7X=#atoN}_4JEu@h z?_lURvz#6k0J9IC7S%ILAQLk4wd diff --git a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/CustomerController.java b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/CustomerController.java index 1da68d3..a1c9c23 100644 --- a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/CustomerController.java +++ b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/CustomerController.java @@ -3,12 +3,14 @@ package com.example.ipLab.StoreDataBase.Controllers; import com.example.ipLab.StoreDataBase.DTO.CustomerDTO; import com.example.ipLab.StoreDataBase.Model.Customer; import com.example.ipLab.StoreDataBase.Service.CustomerService; +import com.example.ipLab.WebConfiguration; +import jakarta.validation.Valid; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController -@RequestMapping("/customer") +@RequestMapping(WebConfiguration.REST_API + "/customer") public class CustomerController { private final CustomerService customerService; @@ -29,19 +31,15 @@ public class CustomerController { } @PostMapping - public CustomerDTO createCustomer(@RequestParam("customerLastName") String customerLastName, - @RequestParam("customerFirstName") String customerFirstName, - @RequestParam("customerMiddleName") String customerMiddleName){ - final Customer customer = customerService.addCustomer(customerLastName, customerFirstName, customerMiddleName); + public CustomerDTO createCustomer(@RequestBody @Valid CustomerDTO customerDTO){ + final Customer customer = customerService.addCustomer(customerDTO.getlastName(), customerDTO.getfirstName(), customerDTO.getmiddleName()); return new CustomerDTO(customer); } @PutMapping("/{id}") - public CustomerDTO updateCustomer(@RequestParam("customerLastName") String customerLastName, - @RequestParam("customerFirstName") String customerFirstName, - @RequestParam("customerMiddleName") String customerMiddleName, + public CustomerDTO updateCustomer(@RequestBody @Valid CustomerDTO customerDTO, @PathVariable Long id){ - return new CustomerDTO(customerService.updateCustomer(id, customerLastName, customerFirstName, customerMiddleName)); + return new CustomerDTO(customerService.updateCustomer(id, customerDTO.getlastName(), customerDTO.getfirstName(), customerDTO.getmiddleName())); } @DeleteMapping("/{id}") diff --git a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/OrderedController.java b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/OrderedController.java index 498ffd1..c1bf254 100644 --- a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/OrderedController.java +++ b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/OrderedController.java @@ -5,12 +5,14 @@ import com.example.ipLab.StoreDataBase.Model.Ordered; import com.example.ipLab.StoreDataBase.Service.CustomerService; import com.example.ipLab.StoreDataBase.Service.OrderService; import com.example.ipLab.StoreDataBase.Service.ProductService; +import com.example.ipLab.WebConfiguration; +import jakarta.validation.Valid; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController -@RequestMapping("/order") +@RequestMapping(WebConfiguration.REST_API + "/order") public class OrderedController { private final OrderService orderedService; private final ProductService productService; @@ -35,17 +37,15 @@ public class OrderedController { } @PostMapping - public OrderedDTO createOrdered(@RequestParam("productId") Long productId, - @RequestParam("customerId") Long customerId, - @RequestParam("quantity") Integer quantity){ - final Ordered ordered = orderedService.addOrder(productService.getProduct(productId), customerService.getCustomer(customerId), quantity); + public OrderedDTO createOrdered(@RequestBody @Valid OrderedDTO orderedDTO){ + final Ordered ordered = orderedService.addOrder(productService.getProduct(orderedDTO.getProductId()), customerService.getCustomer(orderedDTO.getCustomerId()), orderedDTO.quantity); return new OrderedDTO(ordered); } @PutMapping("/{id}") - public OrderedDTO updateOrdered(@RequestParam("quantity") Integer quantity, + public OrderedDTO updateOrdered(@RequestBody @Valid OrderedDTO orderedDTO, @PathVariable Long id){ - return new OrderedDTO(orderedService.updateOrder(id, quantity)); + return new OrderedDTO(orderedService.updateOrder(id, orderedDTO.quantity)); } @DeleteMapping("/{id}") diff --git a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/ProductController.java b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/ProductController.java index db8db1c..aa6cdd3 100644 --- a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/ProductController.java +++ b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/ProductController.java @@ -3,12 +3,14 @@ package com.example.ipLab.StoreDataBase.Controllers; import com.example.ipLab.StoreDataBase.DTO.ProductDTO; import com.example.ipLab.StoreDataBase.Model.Product; import com.example.ipLab.StoreDataBase.Service.ProductService; +import com.example.ipLab.WebConfiguration; +import jakarta.validation.Valid; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController -@RequestMapping("/product") +@RequestMapping(WebConfiguration.REST_API + "/product") public class ProductController { private final ProductService productService; @@ -43,15 +45,15 @@ public class ProductController { } @PostMapping - public ProductDTO createProduct(@RequestParam("productName") String productName){ - final Product product = productService.addProduct(productName); + public ProductDTO createProduct(@RequestBody @Valid ProductDTO productDTO){ + final Product product = productService.addProduct(productDTO.getName()); return new ProductDTO(product); } @PutMapping("/{id}") - public ProductDTO updateProduct(@RequestParam("productName") String productName, + public ProductDTO updateProduct(@RequestBody @Valid ProductDTO productDTO, @PathVariable Long id){ - return new ProductDTO(productService.updateProduct(id, productName)); + return new ProductDTO(productService.updateProduct(id, productDTO.getName())); } @DeleteMapping("/{id}") diff --git a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/StoreController.java b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/StoreController.java index f918377..69cb869 100644 --- a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/StoreController.java +++ b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/Controllers/StoreController.java @@ -7,12 +7,14 @@ import com.example.ipLab.StoreDataBase.Model.Customer; import com.example.ipLab.StoreDataBase.Model.Store; import com.example.ipLab.StoreDataBase.Service.CustomerService; import com.example.ipLab.StoreDataBase.Service.StoreService; +import com.example.ipLab.WebConfiguration; +import jakarta.validation.Valid; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController -@RequestMapping("/store") +@RequestMapping(WebConfiguration.REST_API + "/store") public class StoreController { private final StoreService storeService; @@ -33,21 +35,21 @@ public class StoreController { } @PostMapping - public StoreDTO createStore(@RequestParam("storeName") String storeName){ - final Store store = storeService.addStore(storeName); + public StoreDTO createStore(@RequestBody @Valid StoreDTO storeDTO){ + final Store store = storeService.addStore(storeDTO.getStoreName()); return new StoreDTO(store); } @PutMapping("/{id}") - public StoreDTO updateStore(@RequestParam("storeName") String storeName, + public StoreDTO updateStore(@RequestBody @Valid StoreDTO storeDTO, @PathVariable Long id){ - return new StoreDTO(storeService.updateStore(id, storeName)); + return new StoreDTO(storeService.updateStore(id, storeDTO.getStoreName())); } - @PutMapping("/add") - public ProductDTO addProduct(@RequestParam("storeId") Long storeId, - @RequestParam("productId") Long productId){ - return new ProductDTO(storeService.addProduct(storeId, productId)); + @PutMapping("{id}/add") + public ProductDTO addProduct(@PathVariable Long id, + @RequestBody @Valid CustomerDTO customerDTO){ + return new ProductDTO(storeService.addProduct(id, customerDTO.getId())); } @DeleteMapping("/{id}") diff --git a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/CustomerDTO.java b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/CustomerDTO.java index 25ba14b..d2d41d4 100644 --- a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/CustomerDTO.java +++ b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/CustomerDTO.java @@ -1,14 +1,20 @@ package com.example.ipLab.StoreDataBase.DTO; import com.example.ipLab.StoreDataBase.Model.Customer; - -import java.util.List; +import jakarta.validation.constraints.NotBlank; public class CustomerDTO { - public final Long id; - public final String lastName; - public final String firstName; - public final String middleName; + public Long id; + @NotBlank(message = "lastName can't be null or empty") + public String lastName; + @NotBlank(message = "firstName can't be null or empty") + public String firstName; + @NotBlank(message = "middleName can't be null or empty") + public String middleName; + + public CustomerDTO(){ + + } public CustomerDTO(Customer customer){ this.id = customer.getId(); @@ -20,16 +26,25 @@ public class CustomerDTO { public Long getId() { return id; } - - public String getLastname() { + public void setId(Long id) { + this.id = id; + } + public String getlastName() { return lastName; } - - public String getFirstname() { + public void setlastName(String lastName) { + this.lastName = lastName; + } + public String getfirstName() { return firstName; } - - public String getMiddleName() { + public void setfirstName(String firstName) { + this.firstName = firstName; + } + public String getmiddleName() { return middleName; } + public void setmiddleName(String middleName) { + this.middleName = middleName; + } } diff --git a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/OrderedDTO.java b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/OrderedDTO.java index 2eabeec..24e4fd0 100644 --- a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/OrderedDTO.java +++ b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/OrderedDTO.java @@ -3,11 +3,17 @@ package com.example.ipLab.StoreDataBase.DTO; import com.example.ipLab.StoreDataBase.Model.Ordered; public class OrderedDTO { - public final Long id; - public final int quantity; - public final String productName; - public final String customerFIO; - public final String storeName; + public Long id; + public int quantity; + public String productName; + public String customerFIO; + public String storeName; + public Long customerId; + public Long productId; + + public OrderedDTO(){ + + } public OrderedDTO(Ordered ordered){ this.id = ordered.getId(); @@ -15,6 +21,8 @@ public class OrderedDTO { this.productName = ordered.getProduct().getName(); this.storeName = ordered.getProduct().getStore().getStoreName(); this.customerFIO = ordered.getCustomer().getLastName() + " " + ordered.getCustomer().getFirstName() + " " + ordered.getCustomer().getMiddleName(); + this.customerId = ordered.getProduct().getId(); + this.productId = ordered.getProduct().getId(); } public Long getId() { @@ -36,4 +44,12 @@ public class OrderedDTO { public String getStoreName() { return storeName; } + + public Long getCustomerId() { + return customerId; + } + + public Long getProductId() { + return productId; + } } diff --git a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/ProductDTO.java b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/ProductDTO.java index 826b2b8..ad38611 100644 --- a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/ProductDTO.java +++ b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/ProductDTO.java @@ -5,9 +5,12 @@ import com.example.ipLab.StoreDataBase.Model.Product; import java.util.List; public class ProductDTO { - public final Long id; - public final String productName; - public final String storeName; + public Long id; + public String productName; + public String storeName; + public ProductDTO(){ + + } public ProductDTO(Product product){ this.id = product.getId(); diff --git a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/StoreDTO.java b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/StoreDTO.java index a03e101..8157137 100644 --- a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/StoreDTO.java +++ b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/DTO/StoreDTO.java @@ -5,9 +5,13 @@ import com.example.ipLab.StoreDataBase.Model.Store; import java.util.List; public class StoreDTO { - public final Long id; - public final String storeName; - public final List products; + public Long id; + public String storeName; + public List products; + + public StoreDTO(){ + + } public StoreDTO(Store store){ this.id = store.getId(); diff --git a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/MVC/CustomerMVCController.java b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/MVC/CustomerMVCController.java new file mode 100644 index 0000000..fa6546b --- /dev/null +++ b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/MVC/CustomerMVCController.java @@ -0,0 +1,63 @@ +package com.example.ipLab.StoreDataBase.MVC; + +import com.example.ipLab.StoreDataBase.DTO.CustomerDTO; +import com.example.ipLab.StoreDataBase.Service.CustomerService; +import jakarta.validation.Valid; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +@Controller +@RequestMapping("/customer") +public class CustomerMVCController { + private final CustomerService customerService; + + public CustomerMVCController(CustomerService customerService) { + this.customerService = customerService; + } + + @GetMapping + public String getCustomers(Model model) { + model.addAttribute("customers", + customerService.getAllCustomers().stream() + .map(CustomerDTO::new) + .toList()); + return "customer"; + } + + @GetMapping(value = {"/edit/", "/edit/{id}"}) + public String editCustomer(@PathVariable(required = false) Long id, + Model model) { + if (id == null || id <= 0) { + model.addAttribute("customerDTO", new CustomerDTO()); + } else { + model.addAttribute("customerId", id); + model.addAttribute("customerDTO", new CustomerDTO(customerService.getCustomer(id))); + } + return "customer-edit"; + } + + @PostMapping(value = {"/", "/{id}"}) + public String saveCustomer(@PathVariable(required = false) Long id, + @ModelAttribute @Valid CustomerDTO customerDto, + BindingResult bindingResult, + Model model) { + if (bindingResult.hasErrors()) { + model.addAttribute("errors", bindingResult.getAllErrors()); + return "customer-edit"; + } + if (id == null || id <= 0) { + customerService.addCustomer(customerDto.getlastName(), customerDto.getfirstName(), customerDto.getmiddleName()); + } else { + customerService.updateCustomer(id, customerDto.getlastName(), customerDto.getfirstName(), customerDto.getmiddleName()); + } + return "redirect:/customer"; + } + + @PostMapping("/delete/{id}") + public String deleteCustomer(@PathVariable Long id) { + customerService.deleteCustomer(id); + return "redirect:/customer"; + } +} diff --git a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/util/error/AdviceController.java b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/util/error/AdviceController.java index d9a5aa5..2a261cf 100644 --- a/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/util/error/AdviceController.java +++ b/backend/ipLab/src/main/java/com/example/ipLab/StoreDataBase/util/error/AdviceController.java @@ -11,10 +11,11 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestController; import java.util.stream.Collectors; -@ControllerAdvice +@ControllerAdvice(annotations = RestController.class) public class AdviceController { @ExceptionHandler({ CustomerNotFoundException.class, diff --git a/backend/ipLab/src/main/java/com/example/ipLab/WebConfiguration.java b/backend/ipLab/src/main/java/com/example/ipLab/WebConfiguration.java index 7e79574..8db3443 100644 --- a/backend/ipLab/src/main/java/com/example/ipLab/WebConfiguration.java +++ b/backend/ipLab/src/main/java/com/example/ipLab/WebConfiguration.java @@ -6,6 +6,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class WebConfiguration implements WebMvcConfigurer { + public static final String REST_API = "/api"; @Override public void addCorsMappings(CorsRegistry registry){ registry.addMapping("/**").allowedMethods("*"); diff --git a/backend/ipLab/src/main/resources/public/css/styleSite.css b/backend/ipLab/src/main/resources/public/css/styleSite.css new file mode 100644 index 0000000..53cdb75 --- /dev/null +++ b/backend/ipLab/src/main/resources/public/css/styleSite.css @@ -0,0 +1,284 @@ +header{ + background-color: #9094c1; + flex-direction: row; +} +header nav{ + font-family: Segoe UI; + font-weight: bold; + font-size: 42px; +} +header nav a{ + color: inherit; +} +header nav a:hover{ + text-decoration: underline; +} +.navigationCaption{ + font-family: Segoe UI; + font-weight: bold; + font-size: 42px; +} +.headNav{ + color: inherit; +} +a{ + color: inherit; + text-decoration: none; +} +td, th{ + border: 1px solid black; + font-family: Segoe UI; + text-align: center; + font-size: 28px; +} +table tbody td a:hover{ + text-decoration: underline; + color: inherit; +} + +footer{ + background-color: #707be5; + max-height: 110px; +} + +.mainPage a:hover{ + text-decoration: underline; + color: inherit; +} + +.popularCaption{ + font-family: Segoe UI; + font-size: 24px; +} + +.discountsCaption{ + font-family: Segoe UI; + font-size: 24px; +} + +.item{ + font-family: Segoe UI; + font-size: 18px; +} + +.item img{ + width: 200px; + height: 200px; +} + +.tableMy table caption{ + font-family: Segoe UI; + font-weight: bold; + font-size: 45px; +} +.tableMy table tbody td a:hover{ + text-decoration: underline; + color: inherit !important; +} + +.tableCart table caption{ + font-family: Segoe UI; + font-weight: bold; + font-size: 32px; +} + +.cartInfo{ + margin-top: 320px; + margin-right: 400px; + font-family: Segoe UI; + font-size: 45px; +} + +.buttonOrder{ + background-color: #4d89d9; +} + +.itemCaption{ + font-family: Segoe UI; + font-size: 32px; +} + +#itemPhoto{ + margin-left: 50px; +} + +.itemInfo{ + font-family: Segoe UI; + font-size: 45px; + margin-left: 85px; +} + +.itemInfo li{ + list-style-type: none; +} + +.buttonAdd{ + font-family: Segoe UI; + font-size: 45px; + background-color: #4d89d9; + margin-left: 35px; +} +.companyName{ + font-family: Segoe UI; + font-size: 45px; +} +.longText{ + font-family: Segoe UI; + font-size: 25px; +} +#logoName{ + font-family: Rockwell Condensed; + font-size: 64px; + font-weight: bold; + font-stretch: condensed; + text-decoration: none; +} + +#logoName a:hover{ + text-decoration: none; + color: inherit; +} + +.footerLeft{ + margin-bottom: 10px; + font-family: Segoe UI; + font-size: 16px; +} +.footerBottom{ + font-family: Segoe UI; + font-size: 28px; +} + +.hide{ + display: none; +} + +.active{ + display: block; +} + +.active img{ + width: 200px; + height: 100px; +} + +@media (max-width: 1080px){ + header{ + flex-direction: column; + } + + header nav{ + text-align: center; + } + + .headerContainer{ + flex-direction: column !important; + } + + .itemContent{ + flex-direction: column !important; + justify-content: center !important; + } + + #itemPhoto{ + margin-left: auto !important; + margin-right: auto ; + } + + .itemInfo{ + margin-bottom: 10px !important; + margin-left: 10px!important; + } + + #cartContainer{ + flex-direction: column !important; + } + + .cartInfo{ + margin-top: 0px !important; + margin-left: 5px; + margin-right: auto; + margin-bottom: 10px; + } + + #tableCart{ + width: auto; + } + + .mainPage{ + flex-direction: column !important; + justify-content: center; + } + + .tablePopular{ + margin-left: auto !important; + margin-right: auto !important; + } + + .tableDiscounts{ + margin-top: 30px; + margin-left: auto !important; + margin-right: auto !important; + } +} + +@media (max-width: 767px){ + .tableMy table thead th{ + font-size: 12px !important; + } + + .tableMy table tr td{ + font-size: 12px !important; + } + + .tableCart table thead th{ + font-size: 18px !important; + } + + .tableCart table tr td{ + font-size: 18px !important; + } + + .cartInfo{ + font-size: 18px !important; + } + + .itemInfo{ + font-size: 18px !important; + } + + .buttonAdd{ + font-size: 18px !important + } + + .footerLeft{ + font-size: 12px !important; + } + + .footerBottom{ + font-size: 16px !important; + } + + .footerRight img{ + width: 55px; + height: 27px; + } + + .mainPage img{ + width: 100px !important; + height: 100px !important; + } + + .popularCaption{ + font-size: 18px !important; + } + + .discountsCaption{ + font-size: 18px !important; + } + + #itemIcon{ + width: 250px !important; + height: 250px !important; + } +} \ No newline at end of file diff --git a/backend/ipLab/src/main/resources/public/favicon.ico b/backend/ipLab/src/main/resources/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..0bd84aab1a7a1f3336ab9a3768dd77e960de4a49 GIT binary patch literal 1150 zcmZQzU<5(|0R|wcz>vYhz#zuJz@P!dKp~(AL>x#lFaYJyL7k`Se|$K@Qsh5A{Qu0% z{~&yAcJcqUnZExSCjCdj%IUBFBV&+V`|I5P|KFSj!8FpZJpTvS9U!}H%O1krK*)ZO zA3)e;-+wTM`3E_S@VS4u=!f|O+21fWG5#l7KP(;KqGuZa|Bnyj(gzdArxzp#Q-@A} z+6<8csd?3a+YOu3=i@a4pWc}!tB~^}(3}$(W?{Pj0!Dd19pTMP#T=56& K3=Dtl85jWbb%0O+ literal 0 HcmV?d00001 diff --git a/backend/ipLab/src/main/resources/templates/customer-edit.html b/backend/ipLab/src/main/resources/templates/customer-edit.html new file mode 100644 index 0000000..ca60b54 --- /dev/null +++ b/backend/ipLab/src/main/resources/templates/customer-edit.html @@ -0,0 +1,35 @@ + + + + + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + + Назад + +
+
+
+ + \ No newline at end of file diff --git a/backend/ipLab/src/main/resources/templates/customer.html b/backend/ipLab/src/main/resources/templates/customer.html new file mode 100644 index 0000000..16afff1 --- /dev/null +++ b/backend/ipLab/src/main/resources/templates/customer.html @@ -0,0 +1,55 @@ + + + + + +
+ +
+ + + + + + + + + + + + + + + +
#ФамилияИмяОтчество
+ + + + +
+ + Изменить + + +
+
+ +
+
+
+
+ + \ No newline at end of file diff --git a/backend/ipLab/src/main/resources/templates/default.html b/backend/ipLab/src/main/resources/templates/default.html new file mode 100644 index 0000000..f9b6cb9 --- /dev/null +++ b/backend/ipLab/src/main/resources/templates/default.html @@ -0,0 +1,47 @@ + + + + + IP Example + + + + + + + + +
+
+ +
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/backend/ipLab/src/main/resources/templates/error.html b/backend/ipLab/src/main/resources/templates/error.html new file mode 100644 index 0000000..78fb62d --- /dev/null +++ b/backend/ipLab/src/main/resources/templates/error.html @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/backend/ipLab/src/main/resources/templates/index.html b/backend/ipLab/src/main/resources/templates/index.html new file mode 100644 index 0000000..0749f2c --- /dev/null +++ b/backend/ipLab/src/main/resources/templates/index.html @@ -0,0 +1,13 @@ + + + + + +
+
It's works!
+ ERROR +
+ + \ No newline at end of file diff --git a/frontend/src/components/common/customerTable.jsx b/frontend/src/components/common/customerTable.jsx index 61d4574..4e3a84e 100644 --- a/frontend/src/components/common/customerTable.jsx +++ b/frontend/src/components/common/customerTable.jsx @@ -23,14 +23,15 @@ export default function CustomerTable(props){ } function saveItem() { + let customer = { + lastName: props.data.lastName, + firstName: props.data.firstName, + middleName: props.data.middleName + } if (!isEdit) { - DataService.create(props.url, "?customerLastName=" + props.data.lastName - + "&customerFirstName=" + props.data.firstName - + "&customerMiddleName=" + props.data.middleName).then(() => loadItems()); + DataService.create(props.url, customer).then(() => loadItems()); } else { - DataService.update(props.getUrl + props.data.id, "?customerLastName=" + props.data.lastName - + "&customerFirstName=" + props.data.firstName - + "&customerMiddleName=" + props.data.middleName).then(() => loadItems()); + DataService.update(props.getUrl + props.data.id, customer).then(() => loadItems()); } } diff --git a/frontend/src/components/common/orderTable.jsx b/frontend/src/components/common/orderTable.jsx index 330325e..047ed19 100644 --- a/frontend/src/components/common/orderTable.jsx +++ b/frontend/src/components/common/orderTable.jsx @@ -28,10 +28,15 @@ export default function CustomerTable(props){ } function saveItem() { + let ordered = { + productId: props.data.productId, + customerId: props.data.customerId, + quantity: props.data.quantity + } if (!isEdit) { - DataService.create(props.url, "?productId=" + props.data.productId + "&customerId=" + props.data.customerId + "&quantity=" + props.data.quantity).then(() => loadItems()); + DataService.create(props.url, ordered).then(() => loadItems()); } else { - DataService.update(props.getUrl + props.data.id, "?productId=" + props.data.productId + "&customerId=" + props.data.customerId + "&quantity=" + props.data.quantity).then(() => loadItems()); + DataService.update(props.getUrl + props.data.id, ordered).then(() => loadItems()); } } diff --git a/frontend/src/components/common/productTable.jsx b/frontend/src/components/common/productTable.jsx index 6a8b67b..49e17a3 100644 --- a/frontend/src/components/common/productTable.jsx +++ b/frontend/src/components/common/productTable.jsx @@ -23,10 +23,13 @@ export default function CustomerTable(props){ } function saveItem() { + let product = { + productName: props.data.productName + } if (!isEdit) { - DataService.create(props.url, "?productName=" + props.data.productName).then(() => loadItems()); + DataService.create(props.url, product).then(() => loadItems()); } else { - DataService.update(props.getUrl + props.data.id, "?productName=" + props.data.productName).then(() => loadItems()); + DataService.update(props.getUrl + props.data.id, product).then(() => loadItems()); } } diff --git a/frontend/src/components/common/storeTable.jsx b/frontend/src/components/common/storeTable.jsx index 51a0e21..b1b3bda 100644 --- a/frontend/src/components/common/storeTable.jsx +++ b/frontend/src/components/common/storeTable.jsx @@ -23,10 +23,13 @@ export default function CustomerTable(props){ } function saveItem() { + let store = { + storeName: props.data.storeName + } if (!isEdit) { - DataService.create(props.url, "?storeName=" + props.data.storeName).then(() => loadItems()); + DataService.create(props.url, store).then(() => loadItems()); } else { - DataService.update(props.getUrl + props.data.id, "?storeName=" + props.data.storeName).then(() => loadItems()); + DataService.update(props.getUrl + props.data.id, store).then(() => loadItems()); } } diff --git a/frontend/src/components/pages/addToStorePage.jsx b/frontend/src/components/pages/addToStorePage.jsx index 2c232f7..c725c89 100644 --- a/frontend/src/components/pages/addToStorePage.jsx +++ b/frontend/src/components/pages/addToStorePage.jsx @@ -6,7 +6,7 @@ import { useState, useEffect} from "react"; export default function AddToStorePage(){ const getStoreUrl = 'store'; const getProductUrl = 'product/getWithoutStores' - const url = 'store/add' + const url = 'store/' const [storeOptions, setStoreOptions] = useState([]) const [productOptions, setProductOptions] = useState([]) const transformerProduct = (data) => new Product(data); @@ -44,8 +44,10 @@ export default function AddToStorePage(){ function add(){ var storeId = document.getElementById("storeId").value; var productId = document.getElementById("productId").value; - - DataService.update(url, "?storeId=" + storeId + "&productId=" + productId); + let product = { + id: productId + } + DataService.update(url + storeId + "/add", product); window.location.replace("/product"); } diff --git a/frontend/src/services/DataService.js b/frontend/src/services/DataService.js index a703069..7ed9068 100644 --- a/frontend/src/services/DataService.js +++ b/frontend/src/services/DataService.js @@ -13,7 +13,7 @@ function toJSON(data) { } export default class DataService { - static dataUrlPrefix = 'http://localhost:8080/'; + static dataUrlPrefix = 'http://localhost:8080/api/'; static async readAll(url, transformer) { const response = await axios.get(this.dataUrlPrefix + url); @@ -26,13 +26,12 @@ export default class DataService { } static async create(url, data) { - console.log("Test create " + this.dataUrlPrefix + url + data); - const response = await axios.post(this.dataUrlPrefix + url + data); + const response = await axios.post(this.dataUrlPrefix + url, data); return true; } static async update(url, data) { - const response = await axios.put(this.dataUrlPrefix + url + data); + const response = await axios.put(this.dataUrlPrefix + url, data); return true; }