Advertisement
Guest User

Untitled

a guest
Mar 15th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.20 KB | None | 0 0
  1. @RequestMapping(value = "/order/{id}/close", method = RequestMethod.GET)
  2. public String closeOrder(@PathVariable("id") long id,
  3. Model model) {
  4. SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd ' ' HH:mm:ss");
  5. User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
  6. model.addAttribute("order", orderService.getCheckInfo(id));
  7. model.addAttribute("details", orderDetailService.getOrderDetails(id));
  8. model.addAttribute("closedDate", dateFormat.format(new Date()));
  9. model.addAttribute("waiter", user.getUsername());
  10. orderService.closeOrder(id);
  11. return "/waiter/order_check";
  12. }
  13.  
  14. <div th:replace="fragments :: head"></div>
  15.  
  16.  
  17. <body>
  18. <div th:replace="fragments :: navbar"></div>
  19.  
  20. <div class="container">
  21. <div class="row row-centered">
  22. <div class="col-md-6 col-md-offset-3">
  23. <button class="btn btn-danger dropp">
  24. <i class="glyphicon glyphicon-print"></i> Print check
  25. </button>
  26. <h3 align="center" th:text="${order.creationDate} + ' - ' + ${closedDate}"></h3>
  27. <h1 align="center" th:text="'Order№' + ${order.orderNumber}"></h1>
  28. <p class="text-left" th:text="${order.floorName} + ', Table№' + ${order.tableNumber}"></p>
  29. <p class="text-left" th:text="'Served by ' + ${waiter}"></p>
  30. <table class="table table-condensed">
  31. <thead>
  32. <tr>
  33. <th>Product</th>
  34. <th>Count</th>
  35. <th>Sum</th>
  36. </tr>
  37. </thead>
  38. <tbody>
  39. <tr th:each="detail : ${details}">
  40. <td th:text="${detail.prod_category} + ' ' + ${detail.prod_name}"></td>
  41. <td th:text="${detail.count}"></td>
  42. <td th:text="${detail.sum}"></td>
  43. </tr>
  44. </tbody>
  45. <tbody>
  46. <tr>
  47. <td colspan="2" align="right">Discount amount</td>
  48. <td th:text="${order.discountAmount}"></td>
  49. </tr>
  50. <tr>
  51. <td colspan="2" align="right">Total amount</td>
  52. <td th:text="${order.totalAmount}"></td>
  53. </tr>
  54. </tbody>
  55. </table>
  56. <h2 align="center">Thank you for your visit!</h2>
  57. <h2 align="center">We will be glad to see you again</h2>
  58. </div>
  59. </div>
  60. </div>
  61.  
  62. <div class="modal-shadow"></div>
  63. <div class="modal-window" style="width: 499px; height: 354px;">
  64. <div class="close">X</div>
  65. <img th:src="@{/images/cat.jpg}" class="img-rounded" />
  66. </div>
  67.  
  68. <script>
  69. $(function(){
  70. $('.dropp').click(function () {
  71. $('.modal-shadow').show();
  72. $('.modal-window').show();
  73. });
  74.  
  75. $('.modal-shadow').click(function () {
  76. $('.modal-shadow').hide();
  77. $('.modal-window').hide();
  78. });
  79.  
  80. $('.close').click(function () {
  81. $('.modal-shadow').hide();
  82. $('.modal-window').hide();
  83. });
  84. });
  85. </script>
  86. </body>
  87. </html>
  88.  
  89. <?xml version="1.0" encoding="UTF-8"?>
  90. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  91. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  92. <modelVersion>4.0.0</modelVersion>
  93.  
  94. <groupId>com.spring</groupId>
  95. <artifactId>auth</artifactId>
  96. <version>0.0.1-SNAPSHOT</version>
  97. <packaging>jar</packaging>
  98.  
  99. <name>Restaurant</name>
  100. <description>Restaurant</description>
  101.  
  102. <parent>
  103. <groupId>org.springframework.boot</groupId>
  104. <artifactId>spring-boot-starter-parent</artifactId>
  105. <version>1.5.2.RELEASE</version>
  106. <relativePath/>
  107. </parent>
  108.  
  109. <properties>
  110. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  111. <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  112. <start-class>com.spring.AuthApplication</start-class>
  113. <java.version>1.8</java.version>
  114. </properties>
  115.  
  116. <dependencies>
  117. <dependency>
  118. <groupId>org.springframework.boot</groupId>
  119. <artifactId>spring-boot-starter-data-jpa</artifactId>
  120. </dependency>
  121. <dependency>
  122. <groupId>org.springframework.boot</groupId>
  123. <artifactId>spring-boot-starter-security</artifactId>
  124. </dependency>
  125. <dependency>
  126. <groupId>org.springframework.boot</groupId>
  127. <artifactId>spring-boot-starter-thymeleaf</artifactId>
  128. </dependency>
  129. <dependency>
  130. <groupId>org.springframework.boot</groupId>
  131. <artifactId>spring-boot-starter-validation</artifactId>
  132. </dependency>
  133. <dependency>
  134. <groupId>org.springframework.boot</groupId>
  135. <artifactId>spring-boot-starter-web</artifactId>
  136. </dependency>
  137.  
  138. <dependency>
  139. <groupId>mysql</groupId>
  140. <artifactId>mysql-connector-java</artifactId>
  141. <scope>runtime</scope>
  142. </dependency>
  143.  
  144. <dependency>
  145. <groupId>org.apache.commons</groupId>
  146. <artifactId>commons-lang3</artifactId>
  147. <version>3.5</version>
  148. </dependency>
  149.  
  150. <dependency>
  151. <groupId>org.hibernate</groupId>
  152. <artifactId>hibernate-envers</artifactId>
  153. <version>5.0.11.Final</version>
  154. </dependency>
  155.  
  156.  
  157. </dependencies>
  158.  
  159.  
  160. <build>
  161. <plugins>
  162. <plugin>
  163. <groupId>org.springframework.boot</groupId>
  164. <artifactId>spring-boot-maven-plugin</artifactId>
  165. </plugin>
  166. </plugins>
  167. </build>
  168.  
  169.  
  170. </project>
  171.  
  172. spring.datasource.url = jdbc:mysql://localhost:3306/auth
  173. spring.datasource.username = root
  174. spring.datasource.password = testbd
  175. spring.jpa.show-sql = true
  176. spring.jpa.hibernate.ddl-auto = none
  177. spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
  178. spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
  179. spring.jpa.properties.org.hibernate.envers.default_schema=app_audit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement