products.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. namespace App;
  3. use App\Helpers\HtmlHelper;
  4. /**
  5. * @var Product[] $products
  6. * @var Pagination $pagination
  7. * @var int $product_id
  8. * @var int $supplier_id
  9. * @var string $name
  10. * @var string $sku
  11. * @var int $type
  12. */
  13. ?>
  14. <div class="row mb-3">
  15. <div class="col">
  16. <h3><?=htmlspecialchars(__("Products"))?></h3>
  17. </div>
  18. <div class="col-auto">
  19. <a class="btn btn-success" href="/products/add">
  20. <i class="fa fa-fw fa-plus"></i>
  21. <?=htmlspecialchars(__("Add"))?>
  22. </a>
  23. </div>
  24. </div>
  25. <div class="card mb-3">
  26. <div class="card-header">
  27. <?=htmlspecialchars(__("Filters"))?>
  28. </div>
  29. <div class="card-body">
  30. <form action="/products" method="get">
  31. <div class="row">
  32. <div class="col-sm-4">
  33. <div class="mb-3">
  34. <label class="form-label" for="product-id"><?=htmlspecialchars(__("ID"))?></label>
  35. <input class="form-control" type="number" name="product_id" id="product-id" placeholder="<?=htmlspecialchars(__("Type ID"))?>" value="<?=htmlspecialchars($product_id)?>" />
  36. </div>
  37. </div>
  38. <div class="col-sm-4">
  39. <div class="mb-3">
  40. <label class="form-label" for="supplier-id"><?= htmlspecialchars(__("Supplier")) ?></label>
  41. <select class="form-control" name="supplier_id" id="supplier-id">
  42. <option value=""><?= htmlspecialchars(__("Any Supplier")) ?></option>
  43. <?php
  44. HtmlHelper::renderOptions(Supplier::getOptions(), $supplier_id);
  45. ?>
  46. </select>
  47. </div>
  48. </div>
  49. <div class="col-sm-4">
  50. <div class="mb-3">
  51. <label class="form-label" for="name"><?= htmlspecialchars(__("Name")) ?></label>
  52. <input class="form-control" type="text" name="name" id="name" placeholder="<?= htmlspecialchars(__("Type name")) ?>" value="<?=htmlspecialchars($name)?>" />
  53. </div>
  54. </div>
  55. <div class="col-sm-4">
  56. <div class="mb-3">
  57. <label class="form-label" for="sku"><?= htmlspecialchars(__("SKU")) ?></label>
  58. <input class="form-control" type="text" name="sku" id="sku" placeholder="<?= htmlspecialchars(__("Type SKU")) ?>" value="<?=htmlspecialchars($sku)?>" />
  59. </div>
  60. </div>
  61. <div class="col-sm-4">
  62. <div class="mb-3">
  63. <label class="form-label" for="type"><?=htmlspecialchars(__("Type"))?></label>
  64. <select class="form-control" name="type" id="type">
  65. <option value=""><?=htmlspecialchars(__("Any Type"))?></option>
  66. <?php
  67. HtmlHelper::renderOptions(Product::getTypeOptions(), $type);
  68. ?>
  69. </select>
  70. </div>
  71. </div>
  72. </div>
  73. <button class="btn btn-primary" type="submit">
  74. <?=htmlspecialchars(__("Submit"))?>
  75. </button>
  76. </form>
  77. </div>
  78. </div>
  79. <?php
  80. if(empty($products)) {
  81. ?>
  82. <div class="alert alert-info">
  83. <i class="fa fa-fw fa-info-circle"></i>
  84. <?=htmlspecialchars(__("No products to display."))?>
  85. </div>
  86. <?php
  87. }
  88. else {
  89. View::include("products_table", compact("products"));
  90. $pagination->render();
  91. }