products_table.php 1.3 KB

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