Consolidated ASP Classic MVC framework from best components
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

172 rindas
8.2KB

  1. <div class="container mt-4">
  2. <div class="d-flex justify-content-between align-items-center mb-4">
  3. <h1>
  4. Householder Names
  5. <% If IsObject(HouseholderNameController.household) Then %>
  6. <small class="text-muted">for <%= Server.HTMLEncode(HouseholderNameController.household.Address) %></small>
  7. <% End If %>
  8. </h1>
  9. <a href="/householder-names/new<% If HouseholderNameController.filterHouseholdId > 0 Then Response.Write "?household=" & HouseholderNameController.filterHouseholdId End If %>" class="btn btn-primary">New Householder Name</a>
  10. </div>
  11. <% Flash().ShowSuccessIfPresent %>
  12. <% Flash().ShowErrorsIfPresent %>
  13. <!-- Search Form -->
  14. <div class="card mb-4">
  15. <div class="card-body">
  16. <form method="get" action="/householder-names" class="row g-3">
  17. <div class="col-md-6">
  18. <div class="input-group">
  19. <input type="text" class="form-control" name="q" placeholder="Search by name..." value="<%= Server.HTMLEncode(HouseholderNameController.searchTerm) %>">
  20. <button class="btn btn-outline-primary" type="submit">Search</button>
  21. <% If HouseholderNameController.searchTerm <> "" Or HouseholderNameController.filterHouseholdId > 0 Then %>
  22. <a href="/householder-names" class="btn btn-outline-secondary">Clear</a>
  23. <% End If %>
  24. </div>
  25. </div>
  26. <div class="col-md-3 text-end">
  27. <span class="text-muted">
  28. <% If HouseholderNameController.searchTerm <> "" Then %>
  29. Found <%= HouseholderNameController.recordCount %> result(s)
  30. <% Else %>
  31. <%= HouseholderNameController.recordCount %> total
  32. <% End If %>
  33. </span>
  34. </div>
  35. </form>
  36. </div>
  37. </div>
  38. <% If IsObject(HouseholderNameController.household) Then %>
  39. <div class="alert alert-info">
  40. Showing householder names for: <strong><a href="/households/<%= HouseholderNameController.household.Id %>"><%= Server.HTMLEncode(HouseholderNameController.household.Address) %></a></strong>
  41. <a href="/householder-names" class="btn btn-sm btn-outline-info ms-2">Show All</a>
  42. </div>
  43. <% End If %>
  44. <div class="table-responsive">
  45. <table class="table table-striped table-hover">
  46. <thead class="table-dark">
  47. <tr>
  48. <th>ID</th>
  49. <th>Name</th>
  50. <th>Type</th>
  51. <th>Letter Returned</th>
  52. <th>Created</th>
  53. <th>Actions</th>
  54. </tr>
  55. </thead>
  56. <tbody>
  57. <%
  58. Dim iter, hn
  59. Set iter = HouseholderNameController.householderNames.Iterator()
  60. If Not iter.HasNext() Then
  61. %>
  62. <tr>
  63. <td colspan="6" class="text-center text-muted py-4">
  64. <% If HouseholderNameController.searchTerm <> "" Then %>
  65. No householder names found matching "<%= Server.HTMLEncode(HouseholderNameController.searchTerm) %>"
  66. <% ElseIf HouseholderNameController.filterHouseholdId > 0 Then %>
  67. No householder names for this household. <a href="/householder-names/new?household=<%= HouseholderNameController.filterHouseholdId %>">Add one</a>
  68. <% Else %>
  69. No householder names found. <a href="/householder-names/new">Create one</a>
  70. <% End If %>
  71. </td>
  72. </tr>
  73. <%
  74. Else
  75. Do While iter.HasNext()
  76. Set hn = iter.GetNext()
  77. %>
  78. <tr>
  79. <td><%= hn.Id %></td>
  80. <td><%= Server.HTMLEncode(hn.Name & "") %></td>
  81. <td>
  82. <span class="badge bg-secondary">Household</span>
  83. </td>
  84. <td>
  85. <% If hn.LetterReturned = 1 Then %>
  86. <span class="badge bg-warning text-dark">Returned</span>
  87. <% If Year(hn.ReturnDate) > 1970 Then %>
  88. <small class="text-muted"><%= FormatDateTime(hn.ReturnDate, 2) %></small>
  89. <% End If %>
  90. <% Else %>
  91. <span class="badge bg-success">No</span>
  92. <% End If %>
  93. </td>
  94. <td><%= FormatDateTime(hn.Created, 2) %></td>
  95. <td>
  96. <a href="/householder-names/<%= hn.Id %>" class="btn btn-sm btn-info">View</a>
  97. <a href="/householder-names/<%= hn.Id %>/edit" class="btn btn-sm btn-warning">Edit</a>
  98. <form method="post" action="/householder-names/<%= hn.Id %>/delete" style="display:inline;" onsubmit="return confirm('Are you sure you want to delete this householder name?');">
  99. <button type="submit" class="btn btn-sm btn-danger">Delete</button>
  100. </form>
  101. </td>
  102. </tr>
  103. <%
  104. Loop
  105. End If
  106. %>
  107. </tbody>
  108. </table>
  109. </div>
  110. <!-- Pagination -->
  111. <% If HouseholderNameController.pageCount > 1 Then %>
  112. <%
  113. Dim baseUrl, pg, startPage, endPage
  114. baseUrl = "/householder-names?"
  115. If HouseholderNameController.searchTerm <> "" Then
  116. baseUrl = baseUrl & "q=" & Server.URLEncode(HouseholderNameController.searchTerm) & "&"
  117. End If
  118. If HouseholderNameController.filterHouseholdId > 0 Then
  119. baseUrl = baseUrl & "household=" & HouseholderNameController.filterHouseholdId & "&"
  120. End If
  121. ' Calculate pagination range (show 5 pages at a time)
  122. startPage = HouseholderNameController.currentPage - 2
  123. If startPage < 1 Then startPage = 1
  124. endPage = startPage + 4
  125. If endPage > HouseholderNameController.pageCount Then
  126. endPage = HouseholderNameController.pageCount
  127. startPage = endPage - 4
  128. If startPage < 1 Then startPage = 1
  129. End If
  130. %>
  131. <nav aria-label="Householder names pagination">
  132. <ul class="pagination justify-content-center">
  133. <!-- First page -->
  134. <li class="page-item <% If HouseholderNameController.currentPage = 1 Then Response.Write "disabled" End If %>">
  135. <a class="page-link" href="<%= baseUrl %>page=1">&laquo; First</a>
  136. </li>
  137. <!-- Previous page -->
  138. <li class="page-item <% If HouseholderNameController.currentPage = 1 Then Response.Write "disabled" End If %>">
  139. <a class="page-link" href="<%= baseUrl %>page=<%= HouseholderNameController.currentPage - 1 %>">&lsaquo; Prev</a>
  140. </li>
  141. <!-- Page numbers -->
  142. <% For pg = startPage To endPage %>
  143. <li class="page-item <% If pg = HouseholderNameController.currentPage Then Response.Write "active" End If %>">
  144. <a class="page-link" href="<%= baseUrl %>page=<%= pg %>"><%= pg %></a>
  145. </li>
  146. <% Next %>
  147. <!-- Next page -->
  148. <li class="page-item <% If HouseholderNameController.currentPage >= HouseholderNameController.pageCount Then Response.Write "disabled" End If %>">
  149. <a class="page-link" href="<%= baseUrl %>page=<%= HouseholderNameController.currentPage + 1 %>">Next &rsaquo;</a>
  150. </li>
  151. <!-- Last page -->
  152. <li class="page-item <% If HouseholderNameController.currentPage >= HouseholderNameController.pageCount Then Response.Write "disabled" End If %>">
  153. <a class="page-link" href="<%= baseUrl %>page=<%= HouseholderNameController.pageCount %>">Last &raquo;</a>
  154. </li>
  155. </ul>
  156. </nav>
  157. <p class="text-center text-muted">
  158. Page <%= HouseholderNameController.currentPage %> of <%= HouseholderNameController.pageCount %>
  159. </p>
  160. <% End If %>
  161. </div>

Powered by TurnKey Linux.