25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

125 satır
5.9KB

  1. <div class="page-header">
  2. <h1>Households</h1>
  3. <a class="button button-primary button-sm" href="/households/new">+ New Household</a>
  4. </div>
  5. <div class="section-panel">
  6. <form class="filter-bar" method="GET" action="/households">
  7. <div class="field" style="flex:2;min-width:200px">
  8. <label for="search">Search</label>
  9. <input class="input" type="search" id="search" name="search"
  10. value="<?= e($search) ?>" placeholder="Address or street name…">
  11. </div>
  12. <div class="field" style="flex:1;min-width:160px">
  13. <label for="territory_id">Territory</label>
  14. <select class="input" id="territory_id" name="territory_id">
  15. <option value="">All territories</option>
  16. <?php foreach ($territories as $t): ?>
  17. <option value="<?= e($t['id']) ?>"
  18. <?= $territoryId === (string) $t['id'] ? 'selected' : '' ?>>
  19. <?= e($t['name']) ?>
  20. </option>
  21. <?php endforeach; ?>
  22. </select>
  23. </div>
  24. <div class="field" style="flex:1;min-width:140px">
  25. <label for="do_not_call">Do Not Call</label>
  26. <select class="input" id="do_not_call" name="do_not_call">
  27. <option value="">All</option>
  28. <option value="1" <?= $doNotCall === '1' ? 'selected' : '' ?>>DNC only</option>
  29. <option value="0" <?= $doNotCall === '0' ? 'selected' : '' ?>>Non-DNC only</option>
  30. </select>
  31. </div>
  32. <div class="form-actions" style="align-self:flex-end">
  33. <button class="button button-primary button-sm" type="submit">Filter</button>
  34. <?php if ($search !== '' || $territoryId !== '' || $doNotCall !== ''): ?>
  35. <a class="button button-secondary button-sm" href="/households">Clear</a>
  36. <?php endif; ?>
  37. </div>
  38. </form>
  39. <?php if (empty($households)): ?>
  40. <div class="empty-state">
  41. <p>No households found.</p>
  42. </div>
  43. <?php else: ?>
  44. <div class="table-responsive">
  45. <table class="data-table">
  46. <thead>
  47. <tr>
  48. <th>Address</th>
  49. <th>Street</th>
  50. <th>Territory</th>
  51. <th>Type</th>
  52. <th>DNC</th>
  53. <th>Actions</th>
  54. </tr>
  55. </thead>
  56. <tbody>
  57. <?php foreach ($households as $h): ?>
  58. <tr>
  59. <td>
  60. <a href="/households/<?= e($h['id']) ?>">
  61. <?= e($h['address']) ?>
  62. </a>
  63. </td>
  64. <td class="text-secondary"><?= e((string) ($h['street_name'] ?? '')) ?></td>
  65. <td>
  66. <a href="/territories/<?= e($h['territory_id']) ?>">
  67. <?= e($h['territory_name']) ?>
  68. </a>
  69. </td>
  70. <td>
  71. <?php if ($h['is_business']): ?>
  72. <span class="badge badge-warning">Business</span>
  73. <?php endif; ?>
  74. </td>
  75. <td>
  76. <?php if ($h['do_not_call']): ?>
  77. <span class="badge badge-danger">DNC</span>
  78. <?php if ($h['do_not_call_date']): ?>
  79. <span class="text-secondary" style="font-size:0.8rem">
  80. <?= e($h['do_not_call_date']) ?>
  81. </span>
  82. <?php endif; ?>
  83. <?php endif; ?>
  84. </td>
  85. <td class="table-actions">
  86. <a class="button button-secondary button-sm"
  87. href="/households/<?= e($h['id']) ?>">View</a>
  88. <a class="button button-secondary button-sm"
  89. href="/households/<?= e($h['id']) ?>/edit">Edit</a>
  90. <form method="POST" action="/households/<?= e($h['id']) ?>/delete"
  91. class="inline-form"
  92. onsubmit="return confirm('Delete this household?')">
  93. <?= csrf_field() ?>
  94. <button class="button button-danger button-sm" type="submit">Delete</button>
  95. </form>
  96. </td>
  97. </tr>
  98. <?php endforeach; ?>
  99. </tbody>
  100. </table>
  101. </div>
  102. <?php if ($pagination->hasPages()): ?>
  103. <div class="pagination">
  104. <?php if ($pagination->previousPage()): ?>
  105. <a class="page-link" href="<?= e(paginate_url($pagination->previousPage())) ?>">&lsaquo; Prev</a>
  106. <?php endif; ?>
  107. <?php foreach ($pagination->pageRange() as $p): ?>
  108. <a class="page-link <?= $p === $pagination->page ? 'is-active' : '' ?>"
  109. href="<?= e(paginate_url($p)) ?>"><?= $p ?></a>
  110. <?php endforeach; ?>
  111. <?php if ($pagination->nextPage()): ?>
  112. <a class="page-link" href="<?= e(paginate_url($pagination->nextPage())) ?>">Next &rsaquo;</a>
  113. <?php endif; ?>
  114. <span class="pagination-meta"><?= number_format($pagination->total) ?> total</span>
  115. </div>
  116. <?php endif; ?>
  117. <?php endif; ?>
  118. </div>

Powered by TurnKey Linux.