index.view 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. @Init{
  2. $this->RegisterJSFile("services/weightService.js");
  3. $this->RegisterJSFile("controllers/weight.js");
  4. $this->RegisterJSFile("directives/googleChart.js");
  5. }@
  6. @Title{Weight}@
  7. @CSS{
  8. .input{
  9. padding:5px;
  10. }
  11. .input > *{
  12. display: block;
  13. width:100%;
  14. margin-bottom: 5px;
  15. }
  16. }@
  17. @Body{
  18. <div ng-controller="weight">
  19. <div class="row col-md-4">
  20. <div class="col input">
  21. <label for="weight">Weight (KG)</label>
  22. <input type="number" step="any" ng-model="weight" ng-disabled="submitting" />
  23. </div>
  24. <div class="col input">
  25. <label for="fat">Fat %</label>
  26. <input type="number" step="any" ng-model="fat" ng-disabled="submitting" />
  27. </div>
  28. <div class="col input">
  29. <label for="save">Action</label>
  30. <button id="save" style="padding:5px" ng-click="addReading()" ng-disabled="submitting">Save</button>
  31. </div>
  32. </div>
  33. <div class="row col-lg-1">
  34. <google-chart data="readings" headings="headings" legend-position="top" height="400" title="Historical Weight Data" ignore="['id']"></google-chart>
  35. </div>
  36. <div class="row col-lg-1">
  37. <div class="col">
  38. <h3>Last 10 readings</h3>
  39. <table class="alternatingRows">
  40. <tr>
  41. <th>Date</th>
  42. <th>Weight</th>
  43. <th>BMI</th>
  44. <th>Fat %</th>
  45. <th></th>
  46. </tr>
  47. <tr ng-repeat="reading in tenLatestReadings track by $index">
  48. <td>{{reading.date | date:'d/M/yyyy'}}</td>
  49. <td>{{reading.weight}}</td>
  50. <td>{{reading.bmi}}</td>
  51. <td>{{reading.fat}}</td>
  52. <td><a href="#" ng-click="deleteReading(reading.id)"><img src="/images/delete.svg" /></a></td>
  53. </tr>
  54. </table>
  55. </div>
  56. </div>
  57. <scope-init value="readings"><?=json_encode($readings)?></scope-init>
  58. </div>
  59. }@