Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

92 Zeilen
4.2KB

  1. <div class="page-header">
  2. <h1>Territories</h1>
  3. <div class="page-header-actions">
  4. <a class="button button-primary button-sm" href="/territories/new">+ New Territory</a>
  5. <a class="button button-secondary button-sm" href="/export">Export</a>
  6. </div>
  7. </div>
  8. <div class="section-panel">
  9. <form class="filter-bar" method="GET" action="/territories">
  10. <div class="field" style="flex:1;min-width:220px">
  11. <label for="search">Search</label>
  12. <input class="input" type="search" id="search" name="search"
  13. value="<?= e($search) ?>" placeholder="Name or description…">
  14. </div>
  15. <div class="form-actions" style="align-self:flex-end">
  16. <button class="button button-primary button-sm" type="submit">Filter</button>
  17. <?php if ($search !== ''): ?>
  18. <a class="button button-secondary button-sm" href="/territories">Clear</a>
  19. <?php endif; ?>
  20. </div>
  21. </form>
  22. <?php if (empty($territories)): ?>
  23. <div class="empty-state">
  24. <p>No territories found<?= $search !== '' ? ' matching "' . e($search) . '"' : '' ?>.</p>
  25. <?php if ($search === ''): ?>
  26. <p><a href="/territories/new">Create the first territory</a>.</p>
  27. <?php endif; ?>
  28. </div>
  29. <?php else: ?>
  30. <div class="table-responsive">
  31. <table class="data-table">
  32. <thead>
  33. <tr>
  34. <th>Name</th>
  35. <th>Description</th>
  36. <th>Households</th>
  37. <th>Actions</th>
  38. </tr>
  39. </thead>
  40. <tbody>
  41. <?php foreach ($territories as $territory): ?>
  42. <tr>
  43. <td>
  44. <a href="/territories/<?= e($territory['id']) ?>">
  45. <?= e($territory['name']) ?>
  46. </a>
  47. </td>
  48. <td class="text-secondary"><?= e((string) ($territory['description'] ?? '')) ?></td>
  49. <td><?= (int) ($counts[(int) $territory['id']] ?? 0) ?></td>
  50. <td class="table-actions">
  51. <a class="button button-secondary button-sm"
  52. href="/territories/<?= e($territory['id']) ?>">View</a>
  53. <a class="button button-secondary button-sm"
  54. href="/territories/<?= e($territory['id']) ?>/edit">Edit</a>
  55. <form method="POST" action="/territories/<?= e($territory['id']) ?>/delete"
  56. class="inline-form"
  57. onsubmit="return confirm('Delete territory \'<?= e(addslashes($territory['name'])) ?>\'?')">
  58. <?= csrf_field() ?>
  59. <button class="button button-danger button-sm" type="submit">Delete</button>
  60. </form>
  61. </td>
  62. </tr>
  63. <?php endforeach; ?>
  64. </tbody>
  65. </table>
  66. </div>
  67. <?php if ($pagination->hasPages()): ?>
  68. <div class="pagination">
  69. <?php if ($pagination->previousPage()): ?>
  70. <a class="page-link" href="<?= e(paginate_url($pagination->previousPage())) ?>">&lsaquo; Prev</a>
  71. <?php endif; ?>
  72. <?php foreach ($pagination->pageRange() as $p): ?>
  73. <a class="page-link <?= $p === $pagination->page ? 'is-active' : '' ?>"
  74. href="<?= e(paginate_url($p)) ?>"><?= $p ?></a>
  75. <?php endforeach; ?>
  76. <?php if ($pagination->nextPage()): ?>
  77. <a class="page-link" href="<?= e(paginate_url($pagination->nextPage())) ?>">Next &rsaquo;</a>
  78. <?php endif; ?>
  79. <span class="pagination-meta">
  80. <?= number_format($pagination->total) ?> total
  81. </span>
  82. </div>
  83. <?php endif; ?>
  84. <?php endif; ?>
  85. </div>

Powered by TurnKey Linux.