Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.04 KB | None | 0 0
  1. <title>Custom Plunker</title>
  2.  
  3. <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css">
  4.  
  5. <link rel="stylesheet" href="http://127.0.0.1:8080/Home/bootstrap/bootstrap.css">
  6.  
  7. <link rel="stylesheet" href="http://127.0.0.1:8080/Home/bootstrap/StyleSheet.css">
  8.  
  9. <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
  10.  
  11. <!--<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js"></script>-->
  12.  
  13. <script src="http://127.0.0.1:8080/Home/js/bootstrap.min.js" ></script>
  14.  
  15. <script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.4.0.js"></script>
  16.  
  17. <script src="http://127.0.0.1:8080/Home/js/NestedReal.js"></script>
  18.  
  19. <!-- START TABLE -->
  20. <div class="span12">
  21. <!--<table class="table table-hover table-condensed table-striped">-->
  22. <table class="table table-hover table-condensed table-striped">
  23. <thead>
  24. <tr>
  25. <th>Store ID</th>
  26. <th>Name</th>
  27. <th>Address</th>
  28. <th>City</th>
  29. <th>Cost</th>
  30. <th>Sales</th>
  31. <th>Revenue</th>
  32. <th>Employees</th>
  33. <th>Employees H-sum</th>
  34. </tr>
  35. </thead>
  36. <tbody data-ng-repeat="storedata in storeDataModel.storedata">
  37. <tr id="storedata.store.storeId" class="clickableRow" title="Click to toggle collapse/expand day summaries for this store." data-ng-click="selectTableRow($index, storedata.store.storeId)">
  38. <td>{{storedata.store.storeId}}</td>
  39. <td>{{storedata.store.storeName}}</td>
  40. <td>{{storedata.store.storeAddress}}</td>
  41. <td>{{storedata.store.storeCity}}</td>
  42. <td>{{storedata.data.costTotal}}</td>
  43. <td>{{storedata.data.salesTotal}}</td>
  44. <td>{{storedata.data.revenueTotal}}</td>
  45. <td>{{storedata.data.averageEmployees}}</td>
  46. <td>{{storedata.data.averageEmployeesHours}}</td>
  47. </tr>
  48. <tr">
  49. <td colspan="1">&nbsp;</td>
  50. <td colspan="7">
  51. <div collapse="dayDataCollapse[$index]">
  52. <div class="span12 pull-right">
  53. <table class="table table-hover table-condensed table-striped">
  54. <thead>
  55. <tr>
  56. <th></th>
  57. <th>Date </th>
  58. <th>Cost</th>
  59. <th>Sales</th>
  60. <th>Revenue</th>
  61. <th>Employees</th>
  62. <th>Employees H-sum</th>
  63. </tr>
  64. </thead>
  65. <tbody>
  66. <tr data-ng-repeat="dayData in storeDataModel.storedata[$index].data.dayData">
  67. <td class="pullright">
  68. <td>{{dayData.date}}</td>
  69. <td>{{dayData.cost}}</td>
  70. <td>{{dayData.sales}}</td>
  71. <td>{{dayData.revenue}}</td>
  72. <td>{{dayData.employees}}</td>
  73. <td>{{dayData.employeesHoursSum}}</td>
  74. </tr>
  75. </tbody>
  76. </table>
  77. </div>
  78. </div>
  79. </td>
  80. </tr>
  81. </tbody>
  82. </table>
  83. </div>
  84. <!-- END TABLE -->
  85. </div>
  86.  
  87. $scope.tableRowExpanded = false;
  88. $scope.tableRowIndexCurrExpanded = "";
  89. $scope.tableRowIndexPrevExpanded = "";
  90. $scope.storeIdExpanded = "";
  91. $scope.dayDataCollapse = [true, true, true, true, true, true];
  92.  
  93. $scope.dayDataCollapseFn = function () {
  94. for (var i = 0; storeDataModel.storedata.length - 1; i += 1) {
  95. $scope.dayDataCollapse.append('true');
  96. }
  97. };
  98.  
  99.  
  100.  
  101. $scope.selectTableRow = function (index, storeId) {
  102. if ($scope.dayDataCollapse === 'undefined') {
  103. $scope.dayDataCollapse = $scope.dayDataCollapseFn();
  104. } else {
  105.  
  106. if ($scope.tableRowExpanded === false && $scope.tableRowIndexCurrExpanded === "" && $scope.storeIdExpanded === "") {
  107. $scope.tableRowIndexPrevExpanded = "";
  108. $scope.tableRowExpanded = true;
  109. $scope.tableRowIndexCurrExpanded = index;
  110. $scope.storeIdExpanded = storeId;
  111. $scope.dayDataCollapse[index] = false;
  112. } else if ($scope.tableRowExpanded === true) {
  113. if ($scope.tableRowIndexCurrExpanded === index && $scope.storeIdExpanded === storeId) {
  114. $scope.tableRowExpanded = false;
  115. $scope.tableRowIndexCurrExpanded = "";
  116. $scope.storeIdExpanded = "";
  117. $scope.dayDataCollapse[index] = true;
  118. } else {
  119. $scope.tableRowIndexPrevExpanded = $scope.tableRowIndexCurrExpanded;
  120. $scope.tableRowIndexCurrExpanded = index;
  121. $scope.storeIdExpanded = storeId;
  122. $scope.dayDataCollapse[$scope.tableRowIndexPrevExpanded] = true;
  123. $scope.dayDataCollapse[$scope.tableRowIndexCurrExpanded] = false;
  124. }
  125. }
  126. }
  127. };
  128.  
  129. $scope.storeDataModel = {
  130. "metadata": {
  131. "storesInTotal": "25",
  132. "storesInRepresentation": "6"
  133. },
  134. "storedata": [{
  135. "store": {
  136. "storeId": "1000",
  137. "storeName": "Store 1",
  138. "storePhone": "+46 31 1234567",
  139. "storeAddress": "Avenyn 1",
  140. "storeCity": "Gothenburg"
  141. },
  142. "data": {
  143. "startDate": "2013-07-01",
  144. "endDate": "2013-07-02",
  145. "costTotal": "100000",
  146. "salesTotal": "150000",
  147. "revenueTotal": "50000",
  148. "averageEmployees": "3.5",
  149. "averageEmployeesHours": "26.5",
  150. "dayData": [{
  151. "date": "2013-07-01",
  152. "cost": "50000",
  153. "sales": "71000",
  154. "revenue": "21000",
  155. "employees": "3",
  156. "employeesHoursSum": "24"
  157. }, {
  158. "date": "2013-07-02",
  159. "cost": "50000",
  160. "sales": "79000",
  161. "revenue": "29000",
  162. "employees": "4",
  163. "employeesHoursSum": "29"
  164. }]
  165. }
  166. }, {
  167. "store": {
  168. "storeId": "2000",
  169. "storeName": "Store 2",
  170. "storePhone": "+46 8 9876543",
  171. "storeAddress": "Drottninggatan 100",
  172. "storeCity": "Stockholm"
  173. },
  174. "data": {
  175. "startDate": "2013-07-01",
  176. "endDate": "2013-07-02",
  177. "costTotal": "170000",
  178. "salesTotal": "250000",
  179. "revenueTotal": "80000",
  180. "averageEmployees": "4.5",
  181. "averageEmployeesHours": "35",
  182. "dayData": [{
  183. "date": "2013-07-01",
  184. "cost": "85000",
  185. "sales": "120000",
  186. "revenue": "35000",
  187. "employees": "5",
  188. "employeesHoursSum": "38"
  189. }, {
  190. "date": "2013-07-02",
  191. "cost": "85000",
  192. "sales": "130000",
  193. "revenue": "45000",
  194. "employees": "4",
  195. "employeesHoursSum": "32"
  196. }]
  197. }
  198. }, {
  199. "store": {
  200. "storeId": "3000",
  201. "storeName": "Store 3",
  202. "storePhone": "+1 99 555-1234567",
  203. "storeAddress": "Elm Street",
  204. "storeCity": "New York"
  205. },
  206. "data": {
  207. "startDate": "2013-07-01",
  208. "endDate": "2013-07-02",
  209. "costTotal": "2400000",
  210. "salesTotal": "3800000",
  211. "revenueTotal": "1400000",
  212. "averageEmployees": "25.5",
  213. "averageEmployeesHours": "42",
  214. "dayData": [{
  215. "date": "2013-07-01",
  216. "cost": "1200000",
  217. "sales": "1600000",
  218. "revenue": "400000",
  219. "employees": "23",
  220. "employeesHoursSum": "41"
  221. }, {
  222. "date": "2013-07-02",
  223. "cost": "1200000",
  224. "sales": "2200000",
  225. "revenue": "1000000",
  226. "employees": "28",
  227. "employeesHoursSum": "43"
  228. }]
  229. }
  230. }, {
  231. "store": {
  232. "storeId": "4000",
  233. "storeName": "Store 4",
  234. "storePhone": "0044 34 123-45678",
  235. "storeAddress": "Churchill avenue",
  236. "storeCity": "London"
  237. },
  238. "data": {
  239. "startDate": "2013-07-01",
  240. "endDate": "2013-07-02",
  241. "costTotal": "1700000",
  242. "salesTotal": "2300000",
  243. "revenueTotal": "600000",
  244. "averageEmployees": "13.0",
  245. "averageEmployeesHours": "39",
  246. "dayData": [{
  247. "date": "2013-07-01",
  248. "cost": "850000",
  249. "sales": "1170000",
  250. "revenue": "320000",
  251. "employees": "14",
  252. "employeesHoursSum": "39"
  253. }, {
  254. "date": "2013-07-02",
  255. "cost": "850000",
  256. "sales": "1130000",
  257. "revenue": "280000",
  258. "employees": "12",
  259. "employeesHoursSum": "39"
  260. }]
  261. }
  262. }, {
  263. "store": {
  264. "storeId": "5000",
  265. "storeName": "Store 5",
  266. "storePhone": "+33 78 432-98765",
  267. "storeAddress": "Le Big Mac Rue",
  268. "storeCity": "Paris"
  269. },
  270. "data": {
  271. "startDate": "2013-07-01",
  272. "endDate": "2013-07-02",
  273. "costTotal": "1900000",
  274. "salesTotal": "2500000",
  275. "revenueTotal": "600000",
  276. "averageEmployees": "16.0",
  277. "averageEmployeesHours": "37",
  278. "dayData": [{
  279. "date": "2013-07-01",
  280. "cost": "950000",
  281. "sales": "1280000",
  282. "revenue": "330000",
  283. "employees": "16",
  284. "employeesHoursSum": "37"
  285. }, {
  286. "date": "2013-07-02",
  287. "cost": "950000",
  288. "sales": "1220000",
  289. "revenue": "270000",
  290. "employees": "16",
  291. "employeesHoursSum": "37"
  292. }]
  293. }
  294. }, {
  295. "store": {
  296. "storeId": "6000",
  297. "storeName": "Store 6",
  298. "storePhone": "+49 54 7624214",
  299. "storeAddress": "Bier strasse",
  300. "storeCity": "Berlin"
  301. },
  302. "data": {
  303. "startDate": "2013-07-01",
  304. "endDate": "2013-07-02",
  305. "costTotal": "1800000",
  306. "salesTotal": "2200000",
  307. "revenueTotal": "400000",
  308. "averageEmployees": "11.0",
  309. "averageEmployeesHours": "39",
  310. "dayData": [{
  311. "date": "2013-07-01",
  312. "cost": "900000",
  313. "sales": "1100000",
  314. "revenue": "200000",
  315. "employees": "12",
  316. "employeesHoursSum": "39"
  317. }, {
  318. "date": "2013-07-02",
  319. "cost": "900000",
  320. "sales": "1100000",
  321. "revenue": "200000",
  322. "employees": "10",
  323. "employeesHoursSum": "39"
  324. }]
  325. }
  326. }],
  327. "_links": {
  328. "self": {
  329. "href": "/storedata/between/2013-07-01/2013-07-02"
  330. }
  331. }
  332. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement