sales.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php /** @noinspection PhpUnhandledExceptionInspection */
  2. namespace App;
  3. use App\Enums\SaleStatuses;
  4. use App\Helpers\HtmlHelper;
  5. /**
  6. * @var Sale[] $sales
  7. * @var Pagination $pagination
  8. * @var array $sort_options
  9. * @var int $customer_id
  10. * @var int $location_id
  11. * @var int $status
  12. * @var int $number
  13. * @var string $custom_filter
  14. * @var string $sort
  15. */
  16. $custom_filter_options = [
  17. "open" => __("Open Leads"),
  18. ];
  19. ?>
  20. <div class="row mb-3">
  21. <div class="col">
  22. <h3><?=htmlspecialchars(__("Leads"))?></h3>
  23. </div>
  24. <div class="col-auto">
  25. <a class="btn btn-success" data-bs-toggle="modal" data-bs-target="#new-sale-modal">
  26. <i class="fa fa-fw fa-plus"></i>
  27. <?=htmlspecialchars(__("Add"))?>
  28. </a>
  29. </div>
  30. </div>
  31. <div class="card mb-3">
  32. <div class="card-header">
  33. <?=htmlspecialchars(__("Filters"))?>
  34. </div>
  35. <div class="card-body">
  36. <form action="/leads" method="get">
  37. <div class="row">
  38. <div class="col-sm-4">
  39. <?php
  40. View::include("components/customer_id_field", compact("customer_id"));
  41. ?>
  42. </div>
  43. <div class="col-sm-4">
  44. <?php
  45. View::include("components/location_id_field", compact("location_id"));
  46. ?>
  47. </div>
  48. <div class="col-sm-4">
  49. <div class="mb-3">
  50. <label class="form-label" for="status"><?=htmlspecialchars(__("Status"))?></label>
  51. <select class="form-select" name="status" id="status">
  52. <option value=""><?=htmlspecialchars(__("Any Status"))?></option>
  53. <?php
  54. HtmlHelper::renderOptions(SaleStatuses::options(), $status);
  55. ?>
  56. </select>
  57. </div>
  58. </div>
  59. <div class="col-sm-4">
  60. <div class="mb-3">
  61. <label class="form-label" for="number"><?=htmlspecialchars(__("Number"))?></label>
  62. <input class="form-control" type="number" name="number" id="number" value="<?=htmlspecialchars($number)?>" placeholder="<?=htmlspecialchars(__("Type number"))?>" />
  63. </div>
  64. </div>
  65. <div class="col-sm-4">
  66. <div class="mb-3">
  67. <label class="form-label" for="custom-filter"><?=htmlspecialchars(__("Custom Filter"))?></label>
  68. <select class="form-select" name="custom_filter" id="custom-filter">
  69. <option value=""><?=htmlspecialchars(__("All Leads"))?></option>
  70. <?php
  71. HtmlHelper::renderOptions($custom_filter_options, $custom_filter);
  72. ?>
  73. </select>
  74. </div>
  75. </div>
  76. <div class="col-sm-4">
  77. <div class="mb-3">
  78. <label class="form-label" for="sort"><?=htmlspecialchars(__("Sort"))?></label>
  79. <select class="form-select" name="sort" id="sort">
  80. <?php
  81. HtmlHelper::renderOptions($sort_options, $sort);
  82. ?>
  83. </select>
  84. </div>
  85. </div>
  86. </div>
  87. <button class="btn btn-primary" type="submit">
  88. <?=htmlspecialchars(__("Submit"))?>
  89. </button>
  90. </form>
  91. </div>
  92. </div>
  93. <?php
  94. if(empty($sales)) {
  95. ?>
  96. <div class="alert alert-info">
  97. <i class="fa fa-fw fa-info-circle"></i>
  98. <?=htmlspecialchars(__("No leads to display."))?>
  99. </div>
  100. <?php
  101. }
  102. else {
  103. View::include("sales_table", compact("sales"));
  104. $pagination->render();
  105. }