Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RequestMapping(value = "/order/{id}/close", method = RequestMethod.GET)
- public String closeOrder(@PathVariable("id") long id,
- Model model) {
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd ' ' HH:mm:ss");
- User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
- model.addAttribute("order", orderService.getCheckInfo(id));
- model.addAttribute("details", orderDetailService.getOrderDetails(id));
- model.addAttribute("closedDate", dateFormat.format(new Date()));
- model.addAttribute("waiter", user.getUsername());
- orderService.closeOrder(id);
- return "/waiter/order_check";
- }
- <div th:replace="fragments :: head"></div>
- <body>
- <div th:replace="fragments :: navbar"></div>
- <div class="container">
- <div class="row row-centered">
- <div class="col-md-6 col-md-offset-3">
- <button class="btn btn-danger dropp">
- <i class="glyphicon glyphicon-print"></i> Print check
- </button>
- <h3 align="center" th:text="${order.creationDate} + ' - ' + ${closedDate}"></h3>
- <h1 align="center" th:text="'Order№' + ${order.orderNumber}"></h1>
- <p class="text-left" th:text="${order.floorName} + ', Table№' + ${order.tableNumber}"></p>
- <p class="text-left" th:text="'Served by ' + ${waiter}"></p>
- <table class="table table-condensed">
- <thead>
- <tr>
- <th>Product</th>
- <th>Count</th>
- <th>Sum</th>
- </tr>
- </thead>
- <tbody>
- <tr th:each="detail : ${details}">
- <td th:text="${detail.prod_category} + ' ' + ${detail.prod_name}"></td>
- <td th:text="${detail.count}"></td>
- <td th:text="${detail.sum}"></td>
- </tr>
- </tbody>
- <tbody>
- <tr>
- <td colspan="2" align="right">Discount amount</td>
- <td th:text="${order.discountAmount}"></td>
- </tr>
- <tr>
- <td colspan="2" align="right">Total amount</td>
- <td th:text="${order.totalAmount}"></td>
- </tr>
- </tbody>
- </table>
- <h2 align="center">Thank you for your visit!</h2>
- <h2 align="center">We will be glad to see you again</h2>
- </div>
- </div>
- </div>
- <div class="modal-shadow"></div>
- <div class="modal-window" style="width: 499px; height: 354px;">
- <div class="close">X</div>
- <img th:src="@{/images/cat.jpg}" class="img-rounded" />
- </div>
- <script>
- $(function(){
- $('.dropp').click(function () {
- $('.modal-shadow').show();
- $('.modal-window').show();
- });
- $('.modal-shadow').click(function () {
- $('.modal-shadow').hide();
- $('.modal-window').hide();
- });
- $('.close').click(function () {
- $('.modal-shadow').hide();
- $('.modal-window').hide();
- });
- });
- </script>
- </body>
- </html>
- <?xml version="1.0" encoding="UTF-8"?>
- <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>com.spring</groupId>
- <artifactId>auth</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <packaging>jar</packaging>
- <name>Restaurant</name>
- <description>Restaurant</description>
- <parent>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-parent</artifactId>
- <version>1.5.2.RELEASE</version>
- <relativePath/>
- </parent>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <start-class>com.spring.AuthApplication</start-class>
- <java.version>1.8</java.version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-security</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-thymeleaf</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-validation</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>3.5</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-envers</artifactId>
- <version>5.0.11.Final</version>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </project>
- spring.datasource.url = jdbc:mysql://localhost:3306/auth
- spring.datasource.username = root
- spring.datasource.password = testbd
- spring.jpa.show-sql = true
- spring.jpa.hibernate.ddl-auto = none
- spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
- spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
- spring.jpa.properties.org.hibernate.envers.default_schema=app_audit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement