1
0

products_table.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. $row_class = $product->isArchived() ? "table-secondary" : "";
  24. ?>
  25. <tr class="<?=$row_class?>">
  26. <td class="text-end">
  27. <?=$product->id?>
  28. </td>
  29. <td>
  30. <a href="<?=htmlspecialchars($supplier->getUrl())?>">
  31. <?=htmlspecialchars($supplier->name)?>
  32. </a>
  33. </td>
  34. <td>
  35. <a href="<?=htmlspecialchars($product->getUrl())?>">
  36. <?=htmlspecialchars($product->name)?>
  37. </a>
  38. </td>
  39. <td>
  40. <?=htmlspecialchars($product->sku)?>
  41. </td>
  42. <td>
  43. <?=htmlspecialchars($product->getDisplayType())?>
  44. </td>
  45. <td class="text-end">
  46. <?=htmlspecialchars($product->getDisplayPrice())?>
  47. </td>
  48. <td class="p-1">
  49. <a class="btn btn-sm btn-primary" href="<?=htmlspecialchars($product->getUrl())?>/update">
  50. <?=htmlspecialchars(__("Update"))?>
  51. </a>
  52. </td>
  53. </tr>
  54. <?php
  55. }
  56. ?>
  57. </tbody>
  58. </table>