Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

98 wiersze
4.6KB

  1. <div class="page-header">
  2. <h1>Householder Names</h1>
  3. <a class="button button-primary button-sm" href="/householder-names/new">+ New Name</a>
  4. </div>
  5. <div class="section-panel">
  6. <form class="filter-bar" method="GET" action="/householder-names">
  7. <div class="field" style="flex:1;min-width:200px">
  8. <label for="search">Search name</label>
  9. <input class="input" type="search" id="search" name="search"
  10. value="<?= e($search) ?>" placeholder="Name…">
  11. </div>
  12. <div class="form-actions" style="align-self:flex-end">
  13. <button class="button button-primary button-sm" type="submit">Filter</button>
  14. <?php if ($search !== ''): ?>
  15. <a class="button button-secondary button-sm" href="/householder-names">Clear</a>
  16. <?php endif; ?>
  17. </div>
  18. </form>
  19. <?php if (empty($names)): ?>
  20. <div class="empty-state">
  21. <p>No names found.</p>
  22. </div>
  23. <?php else: ?>
  24. <div class="table-responsive">
  25. <table class="data-table">
  26. <thead>
  27. <tr>
  28. <th>Name</th>
  29. <th>Household</th>
  30. <th>Territory</th>
  31. <th>Letter Returned</th>
  32. <th>Added</th>
  33. <th>Actions</th>
  34. </tr>
  35. </thead>
  36. <tbody>
  37. <?php foreach ($names as $n): ?>
  38. <tr>
  39. <td>
  40. <a href="/householder-names/<?= e($n['id']) ?>">
  41. <?= e($n['name']) ?>
  42. </a>
  43. </td>
  44. <td>
  45. <a href="/households/<?= e($n['household_id']) ?>">
  46. <?= e($n['household_address']) ?>
  47. </a>
  48. </td>
  49. <td class="text-secondary"><?= e($n['territory_name']) ?></td>
  50. <td>
  51. <?php if ($n['letter_returned']): ?>
  52. <span class="badge badge-success">Returned</span>
  53. <?php else: ?>
  54. <span class="text-secondary">—</span>
  55. <?php endif; ?>
  56. </td>
  57. <td class="text-secondary" style="font-size:0.85rem">
  58. <?= e((string) ($n['created_at'] ?? '')) ?>
  59. </td>
  60. <td class="table-actions">
  61. <a class="button button-secondary button-sm"
  62. href="/householder-names/<?= e($n['id']) ?>">View</a>
  63. <a class="button button-secondary button-sm"
  64. href="/householder-names/<?= e($n['id']) ?>/edit">Edit</a>
  65. <form method="POST"
  66. action="/householder-names/<?= e($n['id']) ?>/delete"
  67. class="inline-form"
  68. onsubmit="return confirm('Delete this name?')">
  69. <?= csrf_field() ?>
  70. <button class="button button-danger button-sm" type="submit">Delete</button>
  71. </form>
  72. </td>
  73. </tr>
  74. <?php endforeach; ?>
  75. </tbody>
  76. </table>
  77. </div>
  78. <?php if ($pagination->hasPages()): ?>
  79. <div class="pagination">
  80. <?php if ($pagination->previousPage()): ?>
  81. <a class="page-link" href="<?= e(paginate_url($pagination->previousPage())) ?>">&lsaquo; Prev</a>
  82. <?php endif; ?>
  83. <?php foreach ($pagination->pageRange() as $p): ?>
  84. <a class="page-link <?= $p === $pagination->page ? 'is-active' : '' ?>"
  85. href="<?= e(paginate_url($p)) ?>"><?= $p ?></a>
  86. <?php endforeach; ?>
  87. <?php if ($pagination->nextPage()): ?>
  88. <a class="page-link" href="<?= e(paginate_url($pagination->nextPage())) ?>">Next &rsaquo;</a>
  89. <?php endif; ?>
  90. <span class="pagination-meta"><?= number_format($pagination->total) ?> total</span>
  91. </div>
  92. <?php endif; ?>
  93. <?php endif; ?>
  94. </div>

Powered by TurnKey Linux.