products_table.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php /** @noinspection PhpUnhandledExceptionInspection */
  2. namespace App;
  3. /**
  4. * @var Product[] $products
  5. */
  6. ?>
  7. <table class="table table-bordered">
  8. <thead>
  9. <tr>
  10. <th><?=htmlspecialchars(__("ID"))?></th>
  11. <th><?=htmlspecialchars(__("Supplier"))?></th>
  12. <th><?=htmlspecialchars(__("Name"))?></th>
  13. <th><?=htmlspecialchars(__("Type"))?></th>
  14. <th><?=htmlspecialchars(__("Price"))?></th>
  15. <th><?=htmlspecialchars(__("Actions"))?></th>
  16. </tr>
  17. </thead>
  18. <tbody>
  19. <?php
  20. foreach($products as $product) {
  21. $supplier = $product->getSupplier();
  22. ?>
  23. <tr>
  24. <td class="text-end">
  25. <?=$product->id?>
  26. </td>
  27. <td>
  28. <a href="<?=htmlspecialchars($supplier->getUrl())?>">
  29. <?=htmlspecialchars($supplier->name)?>
  30. </a>
  31. </td>
  32. <td>
  33. <?=htmlspecialchars($product->name)?>
  34. </td>
  35. <td>
  36. <?=htmlspecialchars($product->getDisplayType())?>
  37. </td>
  38. <td class="text-end">
  39. <?=htmlspecialchars($product->getDisplayPrice())?>
  40. </td>
  41. <td class="p-1">
  42. <a class="btn btn-sm btn-primary" href="<?=htmlspecialchars($product->getUrl())?>/update">
  43. <?=htmlspecialchars(__("Update"))?>
  44. </a>
  45. </td>
  46. </tr>
  47. <?php
  48. }
  49. ?>
  50. </tbody>
  51. </table>