sales_table.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php /** @noinspection PhpUnhandledExceptionInspection */
  2. namespace App;
  3. /**
  4. * @var Sale[] $sales
  5. */
  6. $core = Core::getInstance();
  7. $user = $core->getUser();
  8. ?>
  9. <form method="post">
  10. <?php
  11. $user->insertCsrfToken();
  12. ?>
  13. <table class="table table-bordered table-hover mb-3">
  14. <thead>
  15. <tr>
  16. <th></th>
  17. <th><?=htmlspecialchars(__("Ref."))?></th>
  18. <th><?=htmlspecialchars(__("Date"))?></th>
  19. <th><?=htmlspecialchars(__("Location"))?></th>
  20. <th><?=htmlspecialchars(__("Status"))?></th>
  21. <th><?=htmlspecialchars(__("Items"))?></th>
  22. <th><?=htmlspecialchars(__("Value"))?></th>
  23. <th><?=htmlspecialchars(__("Predicted Sold Date"))?></th>
  24. <th><?=htmlspecialchars(__("Last Updated"))?></th>
  25. <th><?=htmlspecialchars(__("Actions"))?></th>
  26. </tr>
  27. </thead>
  28. <tbody>
  29. <?php
  30. foreach($sales as $sale) {
  31. $location = $sale->getLocation();
  32. ?>
  33. <tr>
  34. <td>
  35. <input type="checkbox" name="sale_ids[]" value="<?=$sale->id?>" />
  36. </td>
  37. <td class="text-end">
  38. <a href="<?=htmlspecialchars($sale->getUrl())?>"><?=htmlspecialchars($sale->getReference())?></a>
  39. </td>
  40. <td>
  41. <?=htmlspecialchars($user->formatDate($sale->getDateTimeCreated()))?>
  42. </td>
  43. <td>
  44. <a href="<?=htmlspecialchars($location->getUrl())?>">
  45. <?=htmlspecialchars($location->getDisplayName())?>
  46. </a>
  47. </td>
  48. <td>
  49. <?=htmlspecialchars($sale->getDisplayStatus())?>
  50. </td>
  51. <td>
  52. <?php
  53. foreach($sale->getItems() as $item) {
  54. ?>
  55. <?=htmlspecialchars($item->getProduct()->name)?> &times; <?=$item->quantity?><br />
  56. <?php
  57. }
  58. ?>
  59. </td>
  60. <td class="text-end">
  61. <?=htmlspecialchars($sale->getDisplayAmount())?>
  62. </td>
  63. <td>
  64. <?=htmlspecialchars($sale->getDisplayPredictedSoldDate())?>
  65. </td>
  66. <td>
  67. <?php
  68. $dt_updated = $sale->getDateTimeUpdated();
  69. if($dt_updated) {
  70. echo $dt_updated->diffForHumans();
  71. }
  72. ?>
  73. </td>
  74. <td class="p-1">
  75. <a class="btn btn-sm btn-primary" href="<?=htmlspecialchars($sale->getUrl())?>">
  76. <?=htmlspecialchars(__("View"))?>
  77. </a>
  78. </td>
  79. </tr>
  80. <?php
  81. }
  82. ?>
  83. </tbody>
  84. </table>
  85. <div class="card mb-3">
  86. <div class="card-header">
  87. <?=htmlspecialchars(__("Batch Actions"))?>
  88. </div>
  89. <div class="card-body">
  90. <label class="sr-only" for="batch-action"><?=htmlspecialchars(__("Batch Action"))?></label>
  91. <div class="input-group">
  92. <select class="form-control" name="batch_action" id="batch-action" required>
  93. <option value=""><?=htmlspecialchars(__("Select Batch Action"))?></option>
  94. <option value="mark-completed"><?=htmlspecialchars(__("Mark As Completed"))?></option>
  95. </select>
  96. <button type="submit" class="btn btn-primary">
  97. <?=htmlspecialchars(__("Submit"))?>
  98. </button>
  99. </div>
  100. </div>
  101. </div>
  102. </form>