Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

155 lines
7.3KB

  1. <div class="page-header">
  2. <h1><?= e($household['address']) ?></h1>
  3. <div class="page-header-actions">
  4. <a class="button button-secondary button-sm"
  5. href="/households/<?= e($household['id']) ?>/edit">Edit</a>
  6. <form method="POST" action="/households/<?= e($household['id']) ?>/delete"
  7. class="inline-form"
  8. onsubmit="return confirm('Delete this household?')">
  9. <?= csrf_field() ?>
  10. <button class="button button-danger button-sm" type="submit">Delete</button>
  11. </form>
  12. <a class="button button-secondary button-sm" href="/households">← Back</a>
  13. </div>
  14. </div>
  15. <div class="content-stack">
  16. <div class="section-panel">
  17. <div class="panel-header"><h2>Details</h2></div>
  18. <dl class="detail-list">
  19. <dt>Territory</dt>
  20. <dd>
  21. <a href="/territories/<?= e($household['territory_id']) ?>">
  22. <?= e($household['territory_name']) ?>
  23. </a>
  24. </dd>
  25. <?php if ($household['street_number'] || $household['street_name']): ?>
  26. <dt>Street</dt>
  27. <dd>
  28. <?= e((string) ($household['street_number'] ?? '')) ?>
  29. <?= e((string) ($household['street_name'] ?? '')) ?>
  30. </dd>
  31. <?php endif; ?>
  32. <dt>Type</dt>
  33. <dd>
  34. <?php if ($household['is_business']): ?>
  35. <span class="badge badge-warning">Business</span>
  36. <?php else: ?>
  37. Residential
  38. <?php endif; ?>
  39. </dd>
  40. <dt>Do Not Call</dt>
  41. <dd>
  42. <?php if ($household['do_not_call']): ?>
  43. <span class="badge badge-danger">Yes</span>
  44. <?php if ($household['do_not_call_date']): ?>
  45. <span class="text-secondary">(since <?= e($household['do_not_call_date']) ?>)</span>
  46. <?php endif; ?>
  47. <?php if ($household['do_not_call_notes']): ?>
  48. <p style="margin:0.5rem 0 0"><?= e($household['do_not_call_notes']) ?></p>
  49. <?php endif; ?>
  50. <?php else: ?>
  51. No
  52. <?php endif; ?>
  53. </dd>
  54. <?php if ($household['latitude'] && $household['longitude']): ?>
  55. <dt>Coordinates</dt>
  56. <dd><?= e((string) $household['latitude']) ?>, <?= e((string) $household['longitude']) ?></dd>
  57. <?php endif; ?>
  58. </dl>
  59. </div>
  60. <?php if ($household['latitude'] && $household['longitude'] && $maps['maptiler_api_key'] !== ''): ?>
  61. <div class="section-panel">
  62. <div class="panel-header"><h2>Map</h2></div>
  63. <link rel="stylesheet" href="<?= e($maps['maptiler_sdk_css']) ?>">
  64. <div id="household-map" style="height:380px;border-radius:1rem;overflow:hidden"></div>
  65. <script src="<?= e($maps['maptiler_sdk_js']) ?>"></script>
  66. <script>
  67. maptilersdk.config.apiKey = <?= json_encode($maps['maptiler_api_key']) ?>;
  68. const map = new maptilersdk.Map({
  69. container: 'household-map',
  70. style: <?= json_encode($maps['maptiler_style']) ?>,
  71. center: [<?= (float) $household['longitude'] ?>, <?= (float) $household['latitude'] ?>],
  72. zoom: 15
  73. });
  74. new maptilersdk.Marker()
  75. .setLngLat([<?= (float) $household['longitude'] ?>, <?= (float) $household['latitude'] ?>])
  76. .addTo(map);
  77. </script>
  78. </div>
  79. <?php endif; ?>
  80. <div class="section-panel">
  81. <div class="panel-header" style="display:flex;justify-content:space-between;align-items:center">
  82. <h2 style="margin:0">Householder Names (<?= count($names) ?>)</h2>
  83. <a class="button button-primary button-sm"
  84. href="/householder-names/new?household_id=<?= e($household['id']) ?>">+ Add Name</a>
  85. </div>
  86. <?php if (empty($names)): ?>
  87. <div class="empty-state">
  88. <p>No names recorded for this household.</p>
  89. </div>
  90. <?php else: ?>
  91. <div class="table-responsive">
  92. <table class="data-table">
  93. <thead>
  94. <tr>
  95. <th>Name</th>
  96. <th>Added</th>
  97. <th>Letter Returned</th>
  98. <th>Actions</th>
  99. </tr>
  100. </thead>
  101. <tbody>
  102. <?php foreach ($names as $n): ?>
  103. <tr>
  104. <td><?= e($n['name']) ?></td>
  105. <td class="text-secondary">
  106. <?= e((string) ($n['created_at'] ?? '')) ?>
  107. </td>
  108. <td>
  109. <?php if ($n['letter_returned']): ?>
  110. <span class="badge badge-success">Returned</span>
  111. <?php if ($n['return_date']): ?>
  112. <span class="text-secondary" style="font-size:0.8rem">
  113. <?= e($n['return_date']) ?>
  114. </span>
  115. <?php endif; ?>
  116. <?php else: ?>
  117. <span class="text-secondary">—</span>
  118. <?php endif; ?>
  119. </td>
  120. <td class="table-actions">
  121. <form method="POST"
  122. action="/householder-names/<?= e($n['id']) ?>/mark-returned"
  123. class="inline-form">
  124. <?= csrf_field() ?>
  125. <button class="button button-secondary button-sm" type="submit">
  126. <?= $n['letter_returned'] ? 'Unmark' : 'Mark Returned' ?>
  127. </button>
  128. </form>
  129. <a class="button button-secondary button-sm"
  130. href="/householder-names/<?= e($n['id']) ?>/edit">Edit</a>
  131. <form method="POST"
  132. action="/householder-names/<?= e($n['id']) ?>/delete"
  133. class="inline-form"
  134. onsubmit="return confirm('Delete this name?')">
  135. <?= csrf_field() ?>
  136. <button class="button button-danger button-sm" type="submit">Delete</button>
  137. </form>
  138. </td>
  139. </tr>
  140. <?php endforeach; ?>
  141. </tbody>
  142. </table>
  143. </div>
  144. <?php endif; ?>
  145. </div>
  146. </div>

Powered by TurnKey Linux.