No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

193 líneas
9.1KB

  1. <%
  2. ' Tile helper values: label, number, link, optional emphasis class
  3. Dim tiles, ti, t, pct, pctText, barW, di, dd, barPct, oi, ob, mi, mb, ii, ir, bi_
  4. tiles = Array( _
  5. Array("Prospects", counts("prospects"), "/businesses?show=prospects", ""), _
  6. Array("Previous customers", counts("customers"), "/businesses?show=customers", "text-success"), _
  7. Array("Never contacted", counts("never_contacted"), "/businesses?show=prospects&contacted=never", ""), _
  8. Array("Follow-ups overdue", counts("overdue"), "/", Iif_(counts("overdue") > 0, "text-danger", "")), _
  9. Array("Due today", counts("due_today"), "/", Iif_(counts("due_today") > 0, "text-warning-emphasis", "")), _
  10. Array("Due in the next 7 days", counts("this_week"), "/", ""), _
  11. Array("No phone number", counts("no_phone"), "/businesses?show=prospects", "text-muted"), _
  12. Array("Removed", counts("removed"), "/businesses?status=removed", "text-muted") _
  13. )
  14. %>
  15. <% Flash().ShowErrorsIfPresent : Flash().ShowSuccessIfPresent %>
  16. <div class="d-flex justify-content-between align-items-center mb-3">
  17. <div>
  18. <h1 class="h3 mb-0">Dashboard</h1>
  19. <div class="text-muted small"><%= FormatNumber(counts("active"), 0) %> active businesses &middot; <%= FormatNumber(counts("total"), 0) %> including removed</div>
  20. </div>
  21. </div>
  22. <!-- The list -->
  23. <div class="row g-3 mb-4">
  24. <% For ti = 0 To UBound(tiles)
  25. t = tiles(ti) %>
  26. <div class="col-6 col-md-3">
  27. <a href="<%= t(2) %>" class="card shadow-sm text-decoration-none h-100">
  28. <div class="card-body py-3">
  29. <div class="display-6 fw-semibold <%= t(3) %>"><%= FormatNumber(t(1), 0) %></div>
  30. <div class="small text-muted"><%= t(0) %></div>
  31. </div>
  32. </a>
  33. </div>
  34. <% Next %>
  35. </div>
  36. <div class="row g-3 mb-4">
  37. <!-- Pipeline -->
  38. <div class="col-lg-5">
  39. <div class="card shadow-sm h-100">
  40. <div class="card-body">
  41. <h2 class="h5 mb-3">Where everyone stands</h2>
  42. <%
  43. Dim stages, si, s, tot
  44. stages = Array(Array("New", counts("st_new"), "text-bg-secondary", "new"), Array("Contacted", counts("st_contacted"), "text-bg-info", "contacted"), Array("Follow-up", counts("st_follow_up"), "text-bg-warning", "follow_up"))
  45. tot = counts("st_new") + counts("st_contacted") + counts("st_follow_up")
  46. If tot = 0 Then tot = 1
  47. %>
  48. <div class="progress mb-3" style="height: 1.5rem;" role="img" aria-label="Pipeline breakdown">
  49. <% For si = 0 To UBound(stages)
  50. s = stages(si)
  51. If s(1) > 0 Then %>
  52. <div class="progress-bar <%= s(2) %>" style="width: <%= Round(s(1) * 100 / tot, 1) %>%"><%= s(0) %></div>
  53. <% End If
  54. Next %>
  55. </div>
  56. <table class="table table-sm mb-0">
  57. <% For si = 0 To UBound(stages)
  58. s = stages(si) %>
  59. <tr>
  60. <td><span class="badge <%= s(2) %>"><%= s(0) %></span></td>
  61. <td class="text-end"><a href="/businesses?status=<%= s(3) %>" class="text-decoration-none"><%= FormatNumber(s(1), 0) %></a></td>
  62. <td class="text-end text-muted small"><%= Round(s(1) * 100 / tot, 0) %>%</td>
  63. </tr>
  64. <% Next %>
  65. </table>
  66. <div class="form-text">Counts include previous customers. Removed businesses are not counted here.</div>
  67. </div>
  68. </div>
  69. </div>
  70. <!-- Activity -->
  71. <div class="col-lg-7">
  72. <div class="card shadow-sm h-100">
  73. <div class="card-body">
  74. <h2 class="h5 mb-3">Contact activity</h2>
  75. <div class="row text-center mb-3">
  76. <div class="col-4"><div class="h3 mb-0"><%= FormatNumber(activity("today"), 0) %></div><div class="small text-muted">Today</div></div>
  77. <div class="col-4"><div class="h3 mb-0"><%= FormatNumber(activity("week"), 0) %></div><div class="small text-muted">Last 7 days</div></div>
  78. <div class="col-4"><div class="h3 mb-0"><%= FormatNumber(activity("month"), 0) %></div><div class="small text-muted">Last 30 days</div></div>
  79. </div>
  80. <div class="small text-muted mb-1">Last 14 days</div>
  81. <div class="d-flex align-items-end gap-1" style="height: 90px;" role="img" aria-label="Contacts per day for the last 14 days">
  82. <% For di = 0 To daily.Count - 1
  83. dd = daily(di)
  84. barPct = Round(dd(1) * 100 / maxDaily, 0)
  85. If dd(1) > 0 And barPct < 6 Then barPct = 6 %>
  86. <div class="flex-fill d-flex flex-column justify-content-end align-items-center h-100" title="<%= Date_Fmt(dd(0)) %>: <%= dd(1) %>">
  87. <div class="small text-muted" style="font-size: .7rem;"><% If dd(1) > 0 Then Response.Write dd(1) %></div>
  88. <div class="w-100 rounded-top <% If dd(0) = Date Then Response.Write "bg-primary" Else Response.Write "bg-primary-subtle" %>" style="height: <%= barPct %>%; min-height: <% If dd(1) > 0 Then Response.Write "2px" Else Response.Write "1px" %>;<% If dd(1) = 0 Then Response.Write " background:#dee2e6;" %>"></div>
  89. </div>
  90. <% Next %>
  91. </div>
  92. <div class="d-flex gap-1 small text-muted" style="font-size: .7rem;">
  93. <% For di = 0 To daily.Count - 1 %>
  94. <div class="flex-fill text-center"><%= Day(daily(di)(0)) %></div>
  95. <% Next %>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. <div class="row g-3 mb-4">
  102. <div class="col-md-6">
  103. <div class="card shadow-sm h-100">
  104. <div class="card-body">
  105. <h2 class="h5 mb-3">How you reached out <span class="text-muted fs-6">(30 days)</span></h2>
  106. <% If byMethod.Count = 0 Then %><p class="text-muted mb-0">Nothing logged yet.</p><% Else %>
  107. <table class="table table-sm mb-0">
  108. <% For mi = 0 To byMethod.Count - 1
  109. mb = byMethod(mi) %>
  110. <tr><td><%= H(Businesses_Label(Businesses_Methods(), mb(0))) %></td><td class="text-end"><%= FormatNumber(mb(1), 0) %></td></tr>
  111. <% Next %>
  112. </table>
  113. <% End If %>
  114. </div>
  115. </div>
  116. </div>
  117. <div class="col-md-6">
  118. <div class="card shadow-sm h-100">
  119. <div class="card-body">
  120. <h2 class="h5 mb-3">Outcomes <span class="text-muted fs-6">(30 days)</span></h2>
  121. <% If byOutcome.Count = 0 Then %><p class="text-muted mb-0">Nothing logged yet.</p><% Else %>
  122. <table class="table table-sm mb-0">
  123. <% For oi = 0 To byOutcome.Count - 1
  124. ob = byOutcome(oi) %>
  125. <tr>
  126. <td><% If Len(ob(0)) = 0 Then Response.Write "<span class=""text-muted"">(no outcome)</span>" Else Response.Write H(Businesses_Label(Businesses_Outcomes(), ob(0))) %></td>
  127. <td class="text-end"><%= FormatNumber(ob(1), 0) %></td>
  128. </tr>
  129. <% Next %>
  130. </table>
  131. <% End If %>
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. <div class="row g-3 mb-4">
  137. <div class="col-lg-7">
  138. <div class="card shadow-sm h-100">
  139. <div class="card-body">
  140. <h2 class="h5 mb-3">Biggest industries <span class="text-muted fs-6">(<a href="/industries" class="text-decoration-none">manage</a>)</span></h2>
  141. <% If industries.Count = 0 Then %><p class="text-muted mb-0">No industries yet.</p><% Else %>
  142. <table class="table table-sm align-middle mb-0">
  143. <thead><tr><th>Industry</th><th class="text-end">Businesses</th><th style="width:40%">Contacted</th></tr></thead>
  144. <tbody>
  145. <% For ii = 0 To industries.Count - 1
  146. ir = industries(ii)
  147. If ir(2) > 0 Then pct = Round(ir(3) * 100 / ir(2), 0) Else pct = 0
  148. If ir(3) > 0 And pct = 0 Then pctText = "&lt;1" Else pctText = CStr(pct)
  149. If ir(3) > 0 And pct = 0 Then barW = 1 Else barW = pct %>
  150. <tr>
  151. <td><a href="/businesses?industry=<%= ir(0) %>" class="text-decoration-none"><%= H(ir(1)) %></a></td>
  152. <td class="text-end"><%= FormatNumber(ir(2), 0) %></td>
  153. <td>
  154. <div class="d-flex align-items-center gap-2">
  155. <div class="progress flex-fill" style="height: .6rem;" role="img" aria-label="<%= pctText %> percent contacted"><div class="progress-bar" style="width: <%= barW %>%"></div></div>
  156. <span class="small text-muted text-nowrap"><%= FormatNumber(ir(3), 0) %> &middot; <%= pctText %>%</span>
  157. </div>
  158. </td>
  159. </tr>
  160. <% Next %>
  161. </tbody>
  162. </table>
  163. <% End If %>
  164. </div>
  165. </div>
  166. </div>
  167. <div class="col-lg-5">
  168. <div class="card shadow-sm h-100">
  169. <div class="card-body">
  170. <h2 class="h5 mb-3">Recent imports <span class="text-muted fs-6">(<a href="/import" class="text-decoration-none">import</a>)</span></h2>
  171. <% If imports.Count = 0 Then %><p class="text-muted mb-0">No imports yet.</p><% Else %>
  172. <ul class="list-unstyled mb-0 small">
  173. <% For bi_ = 0 To imports.Count - 1
  174. ir = imports(bi_) %>
  175. <li class="mb-2">
  176. <div class="fw-semibold text-break"><%= H(ir(1)) %></div>
  177. <div class="text-muted"><%= Date_Fmt(ir(2)) %> &middot; <%= FormatNumber(ir(4), 0) %> added of <%= FormatNumber(ir(3), 0) %> rows</div>
  178. </li>
  179. <% Next %>
  180. </ul>
  181. <% End If %>
  182. </div>
  183. </div>
  184. </div>
  185. </div>

Powered by TurnKey Linux.