Consolidated ASP Classic MVC framework from best components
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

292 lignes
13KB

  1. <div class="container mt-4">
  2. <%
  3. Dim dncNotesVal, dncPrivateNotesVal
  4. dncNotesVal = ""
  5. dncPrivateNotesVal = ""
  6. If Not IsNull(HouseholdController.household.DoNotCallNotes) Then dncNotesVal = HouseholdController.household.DoNotCallNotes
  7. If Not IsNull(HouseholdController.household.DoNotCallPrivateNotes) Then dncPrivateNotesVal = HouseholdController.household.DoNotCallPrivateNotes
  8. %>
  9. <nav aria-label="breadcrumb">
  10. <ol class="breadcrumb">
  11. <li class="breadcrumb-item"><a href="/households">Households</a></li>
  12. <li class="breadcrumb-item active" aria-current="page"><%= Server.HTMLEncode(HouseholdController.household.Address) %></li>
  13. </ol>
  14. </nav>
  15. <% Flash().ShowSuccessIfPresent %>
  16. <% Flash().ShowErrorsIfPresent %>
  17. <div class="card">
  18. <div class="card-header d-flex justify-content-between align-items-center">
  19. <h2 class="mb-0"><%= Server.HTMLEncode(HouseholdController.household.Address) %></h2>
  20. <div>
  21. <a href="/households/<%= HouseholdController.household.Id %>/edit" class="btn btn-warning">Edit</a>
  22. <form method="post" action="/households/<%= HouseholdController.household.Id %>/delete" style="display:inline;" onsubmit="return confirm('Are you sure you want to delete this household?');">
  23. <button type="submit" class="btn btn-danger">Delete</button>
  24. </form>
  25. </div>
  26. </div>
  27. <div class="card-body">
  28. <div class="row">
  29. <div class="col-md-6">
  30. <dl>
  31. <dt>ID</dt>
  32. <dd><%= HouseholdController.household.Id %></dd>
  33. <dt>Address</dt>
  34. <dd><%= Server.HTMLEncode(HouseholdController.household.Address) %></dd>
  35. <dt>Street Number</dt>
  36. <dd><%= HouseholdController.household.StreetNumber %></dd>
  37. <dt>Street Name</dt>
  38. <dd><%= Server.HTMLEncode(HouseholdController.household.StreetName & "") %></dd>
  39. <dt>Type</dt>
  40. <dd>
  41. <% If HouseholdController.household.IsBusiness = 1 Then %>
  42. <span class="badge bg-info">Business</span>
  43. <% Else %>
  44. <span class="badge bg-secondary">Residential</span>
  45. <% End If %>
  46. <% If HouseholdController.household.DoNotCall = 1 Then %>
  47. <span class="badge bg-danger ms-2">Do Not Call</span>
  48. <% End If %>
  49. </dd>
  50. <dt>Do Not Call Date</dt>
  51. <dd>
  52. <% If IsDate(HouseholdController.household.DoNotCallDate) Then %>
  53. <%= FormatDateTime(HouseholdController.household.DoNotCallDate, 2) %>
  54. <% Else %>
  55. <span class="text-muted">Not set</span>
  56. <% End If %>
  57. </dd>
  58. <dt>Do Not Call Notes</dt>
  59. <dd>
  60. <% If Trim(dncNotesVal) <> "" Then %>
  61. <%= Server.HTMLEncode(dncNotesVal) %>
  62. <% Else %>
  63. <span class="text-muted">None</span>
  64. <% End If %>
  65. </dd>
  66. <dt>Private DNC Notes</dt>
  67. <dd>
  68. <% If Trim(dncPrivateNotesVal) <> "" Then %>
  69. <%= Server.HTMLEncode(dncPrivateNotesVal) %>
  70. <% Else %>
  71. <span class="text-muted">None</span>
  72. <% End If %>
  73. </dd>
  74. <dt>Territory</dt>
  75. <dd><a href="/territories/<%= HouseholdController.household.TerritoryId %>">Territory <%= HouseholdController.household.TerritoryId %></a></dd>
  76. </dl>
  77. </div>
  78. <div class="col-md-6">
  79. <dl>
  80. <dt>Latitude</dt>
  81. <dd><%= Server.HTMLEncode(HouseholdController.household.Latitude & "") %></dd>
  82. <dt>Longitude</dt>
  83. <dd><%= Server.HTMLEncode(HouseholdController.household.Longitude & "") %></dd>
  84. </dl>
  85. <% If HouseholdController.household.Latitude <> "" And HouseholdController.household.Longitude <> "" Then %>
  86. <div id="map" style="height: 250px; width: 100%; border-radius: 8px;"></div>
  87. <% End If %>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. <!-- Householder Names Section -->
  93. <div class="card mt-4">
  94. <div class="card-header d-flex justify-content-between align-items-center">
  95. <h5 class="mb-0">Householder Names</h5>
  96. <a href="/householder-names/new?household=<%= HouseholdController.household.Id %>" class="btn btn-sm btn-success">Add Name</a>
  97. </div>
  98. <div class="card-body p-0">
  99. <%
  100. Dim hnIter, hn
  101. Set hnIter = HouseholdController.householderNames.Iterator()
  102. If Not hnIter.HasNext() Then
  103. %>
  104. <div class="p-3 text-center text-muted">
  105. No householder names recorded. <a href="/householder-names/new?household=<%= HouseholdController.household.Id %>">Add one</a>
  106. </div>
  107. <%
  108. Else
  109. %>
  110. <table class="table table-hover mb-0">
  111. <thead class="table-light">
  112. <tr>
  113. <th>Name</th>
  114. <th>Type</th>
  115. <th style="width: 180px;">Letter Status</th>
  116. <th style="width: 100px;">Actions</th>
  117. </tr>
  118. </thead>
  119. <tbody>
  120. <%
  121. Do While hnIter.HasNext()
  122. Set hn = hnIter.GetNext()
  123. %>
  124. <tr>
  125. <td>
  126. <a href="/householder-names/<%= hn.Id %>"><%= Server.HTMLEncode(hn.Name & "") %></a>
  127. </td>
  128. <td>
  129. <% If HouseholdController.household.IsBusiness = 1 Then %>
  130. <span class="badge bg-info">Business</span>
  131. <% Else %>
  132. <span class="badge bg-secondary">Residential</span>
  133. <% End If %>
  134. </td>
  135. <td>
  136. <form method="post" action="/households/<%= HouseholdController.household.Id %>/mark-returned" style="display:inline;">
  137. <input type="hidden" name="householder_id" value="<%= hn.Id %>">
  138. <% If hn.LetterReturned = 1 Then %>
  139. <button type="submit" class="btn btn-sm btn-warning" title="Click to mark as NOT returned">
  140. Returned
  141. <% If Year(hn.ReturnDate) > 1970 Then %>
  142. <small>(<%= FormatDateTime(hn.ReturnDate, 2) %>)</small>
  143. <% End If %>
  144. </button>
  145. <% Else %>
  146. <button type="submit" class="btn btn-sm btn-outline-success" title="Click to mark as returned">
  147. Not Returned
  148. </button>
  149. <% End If %>
  150. </form>
  151. </td>
  152. <td>
  153. <a href="/householder-names/<%= hn.Id %>/edit" class="btn btn-sm btn-outline-warning" title="Edit">Edit</a>
  154. </td>
  155. </tr>
  156. <%
  157. Loop
  158. %>
  159. </tbody>
  160. </table>
  161. <%
  162. End If
  163. %>
  164. </div>
  165. </div>
  166. <div class="mt-3">
  167. <a href="/households" class="btn btn-secondary">Back to List</a>
  168. <a href="/households?territory=<%= HouseholdController.household.TerritoryId %>" class="btn btn-outline-primary">View Territory Households</a>
  169. </div>
  170. </div>
  171. <% If HouseholdController.household.Latitude <> "" And HouseholdController.household.Longitude <> "" Then %>
  172. <%
  173. Dim mapProvider, googleMapsKey, mapTilerKey, mapTilerStyle, mapTilerSdkJsUrl, mapTilerSdkCssUrl
  174. mapProvider = LCase(Trim(GetAppSetting("MapProvider") & ""))
  175. If mapProvider <> "maptiler" Then mapProvider = "google"
  176. googleMapsKey = Trim(GetAppSetting("GoogleMapsApiKey") & "")
  177. mapTilerKey = Trim(GetAppSetting("MapTilerApiKey") & "")
  178. mapTilerStyle = Trim(GetAppSetting("MapTilerStyle") & "")
  179. If mapTilerStyle = "" Or LCase(mapTilerStyle) = "nothing" Then mapTilerStyle = "streets-v2"
  180. mapTilerSdkJsUrl = Trim(GetAppSetting("MapTilerSdkJsUrl") & "")
  181. mapTilerSdkCssUrl = Trim(GetAppSetting("MapTilerSdkCssUrl") & "")
  182. If mapTilerSdkJsUrl = "" Or LCase(mapTilerSdkJsUrl) = "nothing" Then mapTilerSdkJsUrl = "https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0/maptiler-sdk.umd.min.js"
  183. If mapTilerSdkCssUrl = "" Or LCase(mapTilerSdkCssUrl) = "nothing" Then mapTilerSdkCssUrl = "https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0/maptiler-sdk.css"
  184. %>
  185. <script>
  186. var householdLat = <%= HouseholdController.household.Latitude %>;
  187. var householdLng = <%= HouseholdController.household.Longitude %>;
  188. var mapProvider = "<%= Replace(mapProvider, """", "\""") %>";
  189. var googleMapsKey = "<%= Replace(googleMapsKey, """", "\""") %>";
  190. var mapTilerKey = "<%= Replace(mapTilerKey, """", "\""") %>";
  191. var mapTilerStyle = "<%= Replace(mapTilerStyle, """", "\""") %>";
  192. </script>
  193. <% If mapProvider = "maptiler" Then %>
  194. <link rel="stylesheet" href="<%= Server.HTMLEncode(mapTilerSdkCssUrl) %>" />
  195. <script src="<%= Server.HTMLEncode(mapTilerSdkJsUrl) %>"></script>
  196. <% Else %>
  197. <script src="https://maps.googleapis.com/maps/api/js?key=<%= Server.HTMLEncode(googleMapsKey) %>&callback=initMap" async defer></script>
  198. <% End If %>
  199. <script>
  200. function setMapMessage(message) {
  201. var mapEl = document.getElementById('map');
  202. if (mapEl) {
  203. mapEl.innerHTML = '<div class="alert alert-info">' + message + '</div>';
  204. }
  205. }
  206. function initMap() {
  207. try {
  208. if (mapProvider === 'maptiler') {
  209. if (!mapTilerKey || mapTilerKey === 'nothing') {
  210. setMapMessage('MapTiler API key is missing.');
  211. return;
  212. }
  213. if (typeof maptilersdk === 'undefined') {
  214. setMapMessage('MapTiler SDK failed to load.');
  215. return;
  216. }
  217. maptilersdk.config.apiKey = mapTilerKey;
  218. var styleUrl = 'https://api.maptiler.com/maps/' + encodeURIComponent(mapTilerStyle) + '/style.json?key=' + encodeURIComponent(mapTilerKey);
  219. var location = [parseFloat(householdLng), parseFloat(householdLat)];
  220. var map = new maptilersdk.Map({
  221. container: 'map',
  222. style: styleUrl,
  223. center: location,
  224. zoom: 17
  225. });
  226. new maptilersdk.Marker()
  227. .setLngLat(location)
  228. .addTo(map);
  229. return;
  230. }
  231. var location = { lat: householdLat, lng: householdLng };
  232. var map = new google.maps.Map(document.getElementById('map'), {
  233. zoom: 17,
  234. center: location,
  235. mapTypeId: 'roadmap'
  236. });
  237. var marker = new google.maps.Marker({
  238. position: location,
  239. map: map,
  240. title: '<%= Replace(HouseholdController.household.Address, "'", "\'") %>'
  241. });
  242. } catch (e) {
  243. setMapMessage('Map error: ' + e.message);
  244. }
  245. }
  246. if (mapProvider === 'maptiler') {
  247. if (document.readyState === 'loading') {
  248. document.addEventListener('DOMContentLoaded', initMap);
  249. } else {
  250. initMap();
  251. }
  252. setTimeout(function() {
  253. if (typeof maptilersdk === 'undefined') {
  254. setMapMessage('MapTiler SDK failed to load.');
  255. }
  256. }, 2000);
  257. } else {
  258. setTimeout(function() {
  259. if (typeof google === 'undefined') {
  260. setMapMessage('Google Maps failed to load.');
  261. }
  262. }, 2000);
  263. }
  264. </script>
  265. <% End If %>

Powered by TurnKey Linux.