sales_table.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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: 40%"/>
  14. <col style="width: 15%"/>
  15. <col style="width: 15%"/>
  16. <col style="width: 15%"/>
  17. <col style="width: 1%"/>
  18. </colgroup>
  19. <thead>
  20. <tr>
  21. <th><?=htmlspecialchars(__("No."))?></th>
  22. <th><?=htmlspecialchars(__("Date"))?></th>
  23. <th><?=htmlspecialchars(__("Location"))?></th>
  24. <th><?=htmlspecialchars(__("Status"))?></th>
  25. <th><?=htmlspecialchars(__("Predicted Sold Date"))?></th>
  26. <th><?=htmlspecialchars(__("Last Updated"))?></th>
  27. <th><?=htmlspecialchars(__("Actions"))?></th>
  28. </tr>
  29. </thead>
  30. <tbody>
  31. <?php
  32. foreach($sales as $sale) {
  33. $location = $sale->getLocation();
  34. ?>
  35. <tr>
  36. <td class="text-end">
  37. <a href="<?=htmlspecialchars($sale->getUrl())?>"><?=htmlspecialchars($sale->getNumber())?></a>
  38. </td>
  39. <td>
  40. <?=htmlspecialchars($user->formatDate($sale->getDateTimeCreated()))?>
  41. </td>
  42. <td>
  43. <a href="<?=htmlspecialchars($location->getUrl())?>">
  44. <?=htmlspecialchars($location->getDisplayName())?>
  45. </a>
  46. </td>
  47. <td>
  48. <?=htmlspecialchars($sale->getDisplayStatus())?>
  49. </td>
  50. <td>
  51. <?=htmlspecialchars($sale->getDisplayPredictedSoldDate())?>
  52. </td>
  53. <td>
  54. <?php
  55. $dt_updated = $sale->getDateTimeUpdated();
  56. if($dt_updated) {
  57. echo $dt_updated->diffForHumans();
  58. }
  59. ?>
  60. </td>
  61. <td class="p-1">
  62. <a class="btn btn-sm btn-primary" href="<?=htmlspecialchars($sale->getUrl())?>">
  63. <?=htmlspecialchars(__("View"))?>
  64. </a>
  65. </td>
  66. </tr>
  67. <?php
  68. }
  69. ?>
  70. </tbody>
  71. </table>