Consolidated ASP Classic MVC framework from best components
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

191 linhas
10KB

  1. <div class="container mt-4">
  2. <nav aria-label="breadcrumb">
  3. <ol class="breadcrumb">
  4. <li class="breadcrumb-item"><a href="/households">Households</a></li>
  5. <li class="breadcrumb-item"><a href="/households/<%= HouseholdController.household.Id %>"><%= Server.HTMLEncode(HouseholdController.household.Address) %></a></li>
  6. <li class="breadcrumb-item active" aria-current="page">Edit</li>
  7. </ol>
  8. </nav>
  9. <h1>Edit Household</h1>
  10. <% Flash().ShowErrorsIfPresent %>
  11. <div class="card">
  12. <div class="card-body">
  13. <form method="post" action="/households/<%= HouseholdController.household.Id %>">
  14. <div class="row">
  15. <div class="col-md-6">
  16. <div class="mb-3">
  17. <label for="Address" class="form-label">Address <span class="text-danger">*</span></label>
  18. <input type="text" class="form-control" id="Address" name="Address" required maxlength="255" value="<%= Server.HTMLEncode(HouseholdController.household.Address) %>">
  19. </div>
  20. <div class="row">
  21. <div class="col-md-4">
  22. <div class="mb-3">
  23. <label for="StreetNumber" class="form-label">Street Number</label>
  24. <input type="number" class="form-control" id="StreetNumber" name="StreetNumber" value="<%= HouseholdController.household.StreetNumber %>">
  25. </div>
  26. </div>
  27. <div class="col-md-8">
  28. <div class="mb-3">
  29. <label for="StreetName" class="form-label">Street Name</label>
  30. <input type="text" class="form-control" id="StreetName" name="StreetName" maxlength="255" value="<%= Server.HTMLEncode(HouseholdController.household.StreetName & "") %>">
  31. </div>
  32. </div>
  33. </div>
  34. <div class="mb-3">
  35. <label for="TerritoryId" class="form-label">Territory <span class="text-danger">*</span></label>
  36. <select class="form-select" id="TerritoryId" name="TerritoryId" required>
  37. <option value="">Select a territory...</option>
  38. <%
  39. Dim tIter, tItem
  40. Set tIter = HouseholdController.territoriesList.Iterator()
  41. Do While tIter.HasNext()
  42. Set tItem = tIter.GetNext()
  43. %>
  44. <option value="<%= tItem.Id %>" <% If tItem.Id = HouseholdController.household.TerritoryId Then Response.Write "selected" End If %>><%= Server.HTMLEncode(tItem.Name) %></option>
  45. <%
  46. Loop
  47. %>
  48. </select>
  49. </div>
  50. <div class="mb-3">
  51. <div class="form-check">
  52. <input class="form-check-input" type="checkbox" id="IsBusiness" name="IsBusiness" value="1"
  53. <% If HouseholdController.household.IsBusiness = 1 Then Response.Write "checked" End If %>>
  54. <label class="form-check-label" for="IsBusiness">
  55. This household is a business
  56. </label>
  57. </div>
  58. </div>
  59. <%
  60. Dim doNotCallDateVal, doNotCallNotesVal, doNotCallPrivateNotesVal
  61. doNotCallDateVal = ""
  62. doNotCallNotesVal = ""
  63. doNotCallPrivateNotesVal = ""
  64. If IsDate(HouseholdController.household.DoNotCallDate) Then
  65. doNotCallDateVal = Year(HouseholdController.household.DoNotCallDate) & "-" & _
  66. Right("0" & Month(HouseholdController.household.DoNotCallDate), 2) & "-" & _
  67. Right("0" & Day(HouseholdController.household.DoNotCallDate), 2)
  68. End If
  69. If Not IsNull(HouseholdController.household.DoNotCallNotes) Then
  70. doNotCallNotesVal = HouseholdController.household.DoNotCallNotes
  71. End If
  72. If Not IsNull(HouseholdController.household.DoNotCallPrivateNotes) Then
  73. doNotCallPrivateNotesVal = HouseholdController.household.DoNotCallPrivateNotes
  74. End If
  75. %>
  76. <div class="card border-danger-subtle mb-3">
  77. <div class="card-body">
  78. <div class="form-check mb-3">
  79. <input class="form-check-input" type="checkbox" id="DoNotCall" name="DoNotCall" value="1"
  80. <% If HouseholdController.household.DoNotCall = 1 Then Response.Write "checked" End If %>>
  81. <label class="form-check-label" for="DoNotCall">
  82. Mark this household as Do Not Call
  83. </label>
  84. </div>
  85. <div class="mb-3">
  86. <label for="DoNotCallDate" class="form-label">Do Not Call Date</label>
  87. <input type="date" class="form-control" id="DoNotCallDate" name="DoNotCallDate" value="<%= doNotCallDateVal %>">
  88. </div>
  89. <div class="mb-3">
  90. <label for="DoNotCallNotes" class="form-label">Do Not Call Notes</label>
  91. <textarea class="form-control" id="DoNotCallNotes" name="DoNotCallNotes" rows="3"><%= Server.HTMLEncode(doNotCallNotesVal) %></textarea>
  92. </div>
  93. <div class="mb-0">
  94. <label for="DoNotCallPrivateNotes" class="form-label">Private Do Not Call Notes</label>
  95. <textarea class="form-control" id="DoNotCallPrivateNotes" name="DoNotCallPrivateNotes" rows="3"><%= Server.HTMLEncode(doNotCallPrivateNotesVal) %></textarea>
  96. </div>
  97. </div>
  98. </div>
  99. <div class="row">
  100. <div class="col-md-6">
  101. <div class="mb-3">
  102. <label for="Latitude" class="form-label">Latitude</label>
  103. <input type="text" class="form-control" id="Latitude" name="Latitude" value="<%= Server.HTMLEncode(HouseholdController.household.Latitude & "") %>">
  104. </div>
  105. </div>
  106. <div class="col-md-6">
  107. <div class="mb-3">
  108. <label for="Longitude" class="form-label">Longitude</label>
  109. <input type="text" class="form-control" id="Longitude" name="Longitude" value="<%= Server.HTMLEncode(HouseholdController.household.Longitude & "") %>">
  110. </div>
  111. </div>
  112. </div>
  113. <div class="d-flex gap-2">
  114. <button type="submit" class="btn btn-primary">Update Household</button>
  115. <a href="/households/<%= HouseholdController.household.Id %>" class="btn btn-secondary">Cancel</a>
  116. </div>
  117. </div>
  118. <div class="col-md-6">
  119. <label class="form-label">Location (click to update coordinates)</label>
  120. <div id="map" style="height: 350px; width: 100%; border-radius: 8px;"></div>
  121. <small class="text-muted">Click on the map to update latitude and longitude.</small>
  122. </div>
  123. </div>
  124. </form>
  125. </div>
  126. </div>
  127. </div>
  128. <script>
  129. var existingLat = <%= IIf(HouseholdController.household.Latitude & "" <> "", HouseholdController.household.Latitude, "null") %>;
  130. var existingLng = <%= IIf(HouseholdController.household.Longitude & "" <> "", HouseholdController.household.Longitude, "null") %>;
  131. </script>
  132. <script src="https://maps.googleapis.com/maps/api/js?key=<%= Server.HTMLEncode(GetAppSetting("GoogleMapsApiKey")) %>&callback=initMap" async defer></script>
  133. <script>
  134. var map, marker;
  135. function initMap() {
  136. var defaultCenter = { lat: -33.8688, lng: 151.2093 };
  137. // Use existing coordinates if available
  138. if (existingLat !== null && existingLng !== null) {
  139. defaultCenter = { lat: existingLat, lng: existingLng };
  140. }
  141. map = new google.maps.Map(document.getElementById('map'), {
  142. zoom: existingLat !== null ? 17 : 12,
  143. center: defaultCenter,
  144. mapTypeId: 'roadmap'
  145. });
  146. // Place marker if coordinates exist
  147. if (existingLat !== null && existingLng !== null) {
  148. marker = new google.maps.Marker({
  149. position: defaultCenter,
  150. map: map
  151. });
  152. }
  153. // Click to place/move marker and set coordinates
  154. map.addListener('click', function(event) {
  155. placeMarker(event.latLng);
  156. });
  157. }
  158. function placeMarker(location) {
  159. if (marker) {
  160. marker.setPosition(location);
  161. } else {
  162. marker = new google.maps.Marker({
  163. position: location,
  164. map: map
  165. });
  166. }
  167. document.getElementById('Latitude').value = location.lat().toFixed(6);
  168. document.getElementById('Longitude').value = location.lng().toFixed(6);
  169. }
  170. </script>

Powered by TurnKey Linux.