Territories

New Territory
<% Flash().ShowSuccessIfPresent %> <% Flash().ShowErrorsIfPresent %>
<% If TerritoryController.searchTerm <> "" Then %> Clear <% End If %>
<% If TerritoryController.searchTerm <> "" Then %> Found <%= TerritoryController.recordCount %> result(s) <% Else %> <%= TerritoryController.recordCount %> total territories <% End If %>
<% Dim iter, t Set iter = TerritoryController.territories.Iterator() If Not iter.HasNext() Then %> <% Else Do While iter.HasNext() Set t = iter.GetNext() %> <% Dim householdCount householdCount = 0 If IsObject(TerritoryController.territoryHouseholdCounts) Then If TerritoryController.territoryHouseholdCounts.Exists(CLng(t.Id)) Then householdCount = TerritoryController.territoryHouseholdCounts(CLng(t.Id)) End If End If %> <% Loop End If %>
ID Name Description Households Actions
<% If TerritoryController.searchTerm <> "" Then %> No territories found matching "<%= Server.HTMLEncode(TerritoryController.searchTerm) %>" <% Else %> No territories found. Create one <% End If %>
<%= t.Id %> <%= Server.HTMLEncode(t.Name) %> <%= Server.HTMLEncode(Left(t.Description & "", 50)) %><% If Len(t.Description & "") > 50 Then Response.Write "..." End If %><%= householdCount %> View Edit
<% If TerritoryController.pageCount > 1 Then %> <% Dim baseUrl, pg, startPage, endPage baseUrl = "/territories?" If TerritoryController.searchTerm <> "" Then baseUrl = baseUrl & "q=" & Server.URLEncode(TerritoryController.searchTerm) & "&" End If ' Calculate pagination range (show 5 pages at a time) startPage = TerritoryController.currentPage - 2 If startPage < 1 Then startPage = 1 endPage = startPage + 4 If endPage > TerritoryController.pageCount Then endPage = TerritoryController.pageCount startPage = endPage - 4 If startPage < 1 Then startPage = 1 End If %>

Page <%= TerritoryController.currentPage %> of <%= TerritoryController.pageCount %>

<% End If %>