| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?php
- namespace App;
- use App\Helpers\HtmlHelper;
- /**
- * @var Product[] $products
- * @var Pagination $pagination
- * @var array $sort_options
- * @var int $product_id
- * @var int $supplier_id
- * @var string $name
- * @var string $sku
- * @var int $type
- * @var string $sort
- */
- ?>
- <div class="row mb-3">
- <div class="col">
- <h3><?=htmlspecialchars(__("Products"))?></h3>
- </div>
- <div class="col-auto">
- <a class="btn btn-success" href="/products/add">
- <i class="fa fa-fw fa-plus"></i>
- <?=htmlspecialchars(__("Add"))?>
- </a>
- </div>
- </div>
- <div class="card mb-3">
- <div class="card-header">
- <?=htmlspecialchars(__("Filters"))?>
- </div>
- <div class="card-body">
- <form action="/products" method="get">
- <div class="row">
- <div class="col-sm-4">
- <div class="mb-3">
- <label class="form-label" for="product-id"><?=htmlspecialchars(__("ID"))?></label>
- <input class="form-control" type="number" name="product_id" id="product-id" placeholder="<?=htmlspecialchars(__("Type ID"))?>" value="<?=htmlspecialchars($product_id)?>" />
- </div>
- </div>
- <div class="col-sm-4">
- <div class="mb-3">
- <label class="form-label" for="supplier-id"><?= htmlspecialchars(__("Supplier")) ?></label>
- <select class="form-select" name="supplier_id" id="supplier-id">
- <option value=""><?= htmlspecialchars(__("Any Supplier")) ?></option>
- <?php
- HtmlHelper::renderOptions(Supplier::getOptions(), $supplier_id);
- ?>
- </select>
- </div>
- </div>
- <div class="col-sm-4">
- <div class="mb-3">
- <label class="form-label" for="name"><?= htmlspecialchars(__("Name")) ?></label>
- <input class="form-control" type="text" name="name" id="name" placeholder="<?= htmlspecialchars(__("Type name")) ?>" value="<?=htmlspecialchars($name)?>" />
- </div>
- </div>
- <div class="col-sm-4">
- <div class="mb-3">
- <label class="form-label" for="sku"><?= htmlspecialchars(__("SKU")) ?></label>
- <input class="form-control" type="text" name="sku" id="sku" placeholder="<?= htmlspecialchars(__("Type SKU")) ?>" value="<?=htmlspecialchars($sku)?>" />
- </div>
- </div>
- <div class="col-sm-4">
- <div class="mb-3">
- <label class="form-label" for="type"><?=htmlspecialchars(__("Type"))?></label>
- <select class="form-select" name="type" id="type">
- <option value=""><?=htmlspecialchars(__("Any Type"))?></option>
- <?php
- HtmlHelper::renderOptions(Product::getTypeOptions(), $type);
- ?>
- </select>
- </div>
- </div>
- <div class="col-sm-4">
- <div class="mb-3">
- <div class="mb-3">
- <label class="form-label" for="sort"><?= htmlspecialchars(__("Sort")) ?></label>
- <select class="form-select" name="sort" id="sort">
- <?php
- HtmlHelper::renderOptions($sort_options, $sort);
- ?>
- </select>
- </div>
- </div>
- </div>
- </div>
- <button class="btn btn-primary" type="submit">
- <?=htmlspecialchars(__("Submit"))?>
- </button>
- </form>
- </div>
- </div>
- <?php
- if(empty($products)) {
- ?>
- <div class="alert alert-info">
- <i class="fa fa-fw fa-info-circle"></i>
- <?=htmlspecialchars(__("No products to display."))?>
- </div>
- <?php
- }
- else {
- View::include("products_table", compact("products"));
- $pagination->render();
- }
|