| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <?php /** @noinspection PhpUnhandledExceptionInspection */
- namespace App;
- use App\Enums\SaleStatuses;
- use App\Helpers\HtmlHelper;
- /**
- * @var Sale[] $sales
- * @var Pagination $pagination
- * @var int $customer_id
- * @var int $location_id
- * @var int $status
- * @var int $number
- * @var string $custom_filter
- */
- $custom_filter_options = [
- "open" => __("Open Sales"),
- ];
- ?>
- <div class="row mb-3">
- <div class="col">
- <h3><?=htmlspecialchars(__("Sales"))?></h3>
- </div>
- <div class="col-auto">
- <a class="btn btn-success" data-bs-toggle="modal" data-bs-target="#new-sale-modal">
- <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="/sales" method="post">
- <div class="row">
- <div class="col-sm-4">
- <?php
- View::include("components/customer_id_field", compact("customer_id"));
- ?>
- </div>
- <div class="col-sm-4">
- <?php
- View::include("components/location_id_field", compact("location_id"));
- ?>
- </div>
- <div class="col-sm-4">
- <div class="mb-3">
- <label class="form-label" for="status"><?=htmlspecialchars(__("Status"))?></label>
- <select class="form-control" name="status" id="status">
- <option value=""><?=htmlspecialchars(__("Any Status"))?></option>
- <?php
- HtmlHelper::renderOptions(SaleStatuses::options(), $status);
- ?>
- </select>
- </div>
- </div>
- <div class="col-sm-4">
- <div class="mb-3">
- <label class="form-label" for="number"><?=htmlspecialchars(__("Number"))?></label>
- <input class="form-control" type="number" name="number" id="number" value="<?=htmlspecialchars($number)?>" placeholder="<?=htmlspecialchars(__("Type number"))?>" />
- </div>
- </div>
- <div class="col-sm-4">
- <div class="mb-3">
- <label class="form-label" for="custom-filter"><?=htmlspecialchars(__("Custom Filter"))?></label>
- <select class="form-control" name="custom_filter" id="custom-filter">
- <option value=""><?=htmlspecialchars(__("All Sales"))?></option>
- <?php
- HtmlHelper::renderOptions($custom_filter_options, $custom_filter);
- ?>
- </select>
- </div>
- </div>
- </div>
- <button class="btn btn-primary" type="submit">
- <?=htmlspecialchars(__("Submit"))?>
- </button>
- </form>
- </div>
- </div>
- <?php
- if(empty($sales)) {
- ?>
- <div class="alert alert-info">
- <i class="fa fa-fw fa-info-circle"></i>
- <?=htmlspecialchars(__("No sales to display."))?>
- </div>
- <?php
- }
- else {
- ?>
- <table class="table table-bordered table-hover mb-3">
- <thead>
- <tr>
- <th><?=htmlspecialchars(__("Number"))?></th>
- <th><?=htmlspecialchars(__("Location"))?></th>
- <th><?=htmlspecialchars(__("Status"))?></th>
- <th><?=htmlspecialchars(__("Actions"))?></th>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach($sales as $sale) {
- $location = $sale->getLocation();
- ?>
- <tr>
- <td class="text-end">
- <a href="<?=htmlspecialchars($sale->getUrl())?>"><?=htmlspecialchars($sale->getNumber())?></a>
- </td>
- <td>
- <a href="<?=htmlspecialchars($location->getUrl())?>">
- <?=htmlspecialchars($location->getDisplayName())?>
- </a>
- </td>
- <td>
- <?=htmlspecialchars($sale->getDisplayStatus())?>
- </td>
- <td class="p-1">
- <a class="btn btn-sm btn-primary" href="<?=htmlspecialchars($sale->getUrl())?>">
- <?=htmlspecialchars(__("View"))?>
- </a>
- </td>
- </tr>
- <?php
- }
- ?>
- </tbody>
- </table>
- <?php
- $pagination->render();
- }
|