sales_table.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php /** @noinspection PhpUnhandledExceptionInspection */
  2. namespace App;
  3. /**
  4. * @var Sale[] $sales
  5. */
  6. $core = Core::getInstance();
  7. $user = $core->getUser();
  8. ?>
  9. <table class="table table-bordered table-hover mb-3">
  10. <colgroup>
  11. <col style="width: 1%"/>
  12. <col style="width: 15%"/>
  13. <col style="width: 35%"/>
  14. <col style="width: 10%"/>
  15. <col style="width: 10%"/>
  16. <col style="width: 15%"/>
  17. <col style="width: 15%"/>
  18. <col style="width: 1%"/>
  19. </colgroup>
  20. <thead>
  21. <tr>
  22. <th><?=htmlspecialchars(__("Ref."))?></th>
  23. <th><?=htmlspecialchars(__("Date"))?></th>
  24. <th><?=htmlspecialchars(__("Location"))?></th>
  25. <th><?=htmlspecialchars(__("Status"))?></th>
  26. <th><?=htmlspecialchars(__("Value"))?></th>
  27. <th><?=htmlspecialchars(__("Predicted Sold Date"))?></th>
  28. <th><?=htmlspecialchars(__("Last Updated"))?></th>
  29. <th><?=htmlspecialchars(__("Actions"))?></th>
  30. </tr>
  31. </thead>
  32. <tbody>
  33. <?php
  34. foreach($sales as $sale) {
  35. $location = $sale->getLocation();
  36. ?>
  37. <tr>
  38. <td class="text-end">
  39. <a href="<?=htmlspecialchars($sale->getUrl())?>"><?=htmlspecialchars($sale->getReference())?></a>
  40. </td>
  41. <td>
  42. <?=htmlspecialchars($user->formatDate($sale->getDateTimeCreated()))?>
  43. </td>
  44. <td>
  45. <a href="<?=htmlspecialchars($location->getUrl())?>">
  46. <?=htmlspecialchars($location->getDisplayName())?>
  47. </a>
  48. </td>
  49. <td>
  50. <?=htmlspecialchars($sale->getDisplayStatus())?>
  51. </td>
  52. <td class="text-end">
  53. <?=htmlspecialchars($sale->getDisplayAmount())?>
  54. </td>
  55. <td>
  56. <?=htmlspecialchars($sale->getDisplayPredictedSoldDate())?>
  57. </td>
  58. <td>
  59. <?php
  60. $dt_updated = $sale->getDateTimeUpdated();
  61. if($dt_updated) {
  62. echo $dt_updated->diffForHumans();
  63. }
  64. ?>
  65. </td>
  66. <td class="p-1">
  67. <a class="btn btn-sm btn-primary" href="<?=htmlspecialchars($sale->getUrl())?>">
  68. <?=htmlspecialchars(__("View"))?>
  69. </a>
  70. </td>
  71. </tr>
  72. <?php
  73. }
  74. ?>
  75. </tbody>
  76. </table>