Advertisement
Guest User

Untitled

a guest
Feb 25th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.83 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en" ng-app="demo">
  3. <head>
  4. <meta charset="UTF-8"/>
  5. <title>Webstore Home</title>
  6. <!-- Latest compiled and minified CSS -->
  7. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css"/>
  8. <link integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"/>
  9. <script src="/webjars/jquery/1.11.1/jquery.min.js"></script>
  10. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  11. <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.6/umd/popper.min.js"></script>
  12. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>
  13. <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
  14. <!-- Latest compiled and minified JavaScript -->
  15. <script src="/webjars/bootstrap/3.3.7-1/js/bootstrap.min.js"
  16. integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
  17. crossorigin="anonymous"></script>
  18. </head>
  19. <body ng-controller="Hello">
  20. <nav class="navbar navbar-expand-sm bg-info navbar-dark">
  21. <div class="container">
  22. <a class="navbar-brand" href="/index">Start Webstore</a>
  23. <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
  24. <span class="navbar-toggler-icon"></span>
  25. </button>
  26. <div>
  27. <div class="collapse navbar-collapse" id="navbarResponsive">
  28. <ul class="navbar-nav ml-auto">
  29. <li class="nav-item">
  30. <a class="nav-link" href="/login">Zaloguj</a>
  31. </li>
  32. <li class="nav-item">
  33. <a class="nav-link" href="/registration">Rejestracja</a>
  34. </li>
  35. </ul>
  36. </div>
  37. </div>
  38. </div>
  39. </nav>
  40. <div class="container">
  41. <table id="cart" class="table table-hover table-condensed">
  42. <thead>
  43. <tr>
  44. <th style="width:72%">Produkt</th>
  45. <th style="width:10%">Cena</th>
  46. <th style="width:8%">Ilość</th>
  47. <th style="width:10%"></th>
  48. </tr>
  49. </thead>
  50. <tbody ng-repeat="item in items.cartItemList">
  51. <td data-th="Product">
  52. <div class="row">
  53. <div class="col-sm-10">
  54. <h4 class="nomargin">{{item.product.name}}</h4>
  55. <p>{{item.product.description}}</p>
  56. </div>
  57. </div>
  58. </td>
  59. <td data-th="Price">{{item.price}} PLN</td>
  60. <td data-th="Quantity">{{item.quantity}}</td>
  61. <td class="actions" data-th="">
  62. <a href="/cart" type="button" class="btn btn-info"
  63. ng-click="removeFromCart(item.product.id)">Usuń</a>
  64. </td>
  65. </tbody>
  66. <tfoot ng-if="items.cartItemList.length > 0">
  67. <tr>
  68. <td>
  69. <a href="/logout" class="btn btn-info ">Kontynuuj zakupy </a>
  70. </td>
  71. <td class="hidden-xs text-center">
  72. <strong>Łącznie {{items.subTotal}} PLN</strong>
  73. </td>
  74. <td>
  75. <a href="#" class="btn btn-success actions">Do kasy</a>
  76. </td>
  77. </tr>
  78. </tfoot>
  79. </table>
  80. <h1 ng-if="!items.cartItemList.length > 0">
  81. <small>Twój koszyk jest pusty</small>
  82. </h1>
  83. </div>
  84. </div>
  85. <script>
  86. angular.module('demo', [])
  87. .controller('Hello', function($scope, $http) {
  88. $http.get('http://localhost:8080/rest/cart').
  89. then(function(response) {
  90. $scope.items = response.data;
  91. });
  92. $scope.removeFromCart = function(productId) {
  93. $http.delete('/delete/' + productId)
  94. .then(function (data) {
  95. $http.get('/cart');
  96. });
  97. };
  98. });
  99.  
  100. </script>
  101. </body>
  102. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement