|
1 | 1 | @model Neolution.OrchardCoreModules.PageViewStats.ViewModels.DashboardViewModel |
2 | 2 |
|
| 3 | +@functions |
| 4 | +{ |
| 5 | + string GetDropDownButtonText() |
| 6 | + { |
| 7 | + return Model.History > 0 ? $"Last {Model.History} days" : "Since ever"; |
| 8 | + } |
| 9 | +} |
| 10 | + |
3 | 11 | <div class="row"> |
4 | 12 | <div class="col"> |
5 | 13 | <h1>Page View Statistics</h1> |
6 | | - <div class="form-group d-inline-flex float-right mb-1"> |
| 14 | + </div> |
| 15 | +</div> |
| 16 | + |
| 17 | +<ul class="nav nav-tabs"> |
| 18 | + <li class="nav-item pr-md-2"> |
| 19 | + <a class="nav-link active" id="byday-tab" data-bs-toggle="tab" href="#byday" role="tab" aria-controls="byday" aria-selected="true">@T["By day"]</a> |
| 20 | + </li> |
| 21 | + <li class="nav-item pr-md-2"> |
| 22 | + <a class="nav-link" id="bysite-tab" data-bs-toggle="tab" href="#bysite" role="tab" aria-controls="bysite">@T["By site"]</a> |
| 23 | + </li> |
| 24 | +</ul> |
| 25 | + |
| 26 | +<div class="tab-content" id="tabs"> |
| 27 | + |
| 28 | + <div class="tab-pane fade show active" id="byday" role="tabpanel" aria-labelledby="byday-tab"> |
| 29 | + <div class="form-group d-inline-flex float-end mb-1"> |
7 | 30 | <div class="btn-group"> |
8 | 31 | <div class="dropdown order-md-1"> |
9 | 32 | <button type="button" class="btn btn-secondary btn-sm dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> |
10 | | - Last @Model.History days |
| 33 | + @GetDropDownButtonText() |
11 | 34 | </button> |
12 | 35 | <ul class="dropdown-menu"> |
13 | | - <li><a class="dropdown-item" href="?history=7">Last week</a></li> |
14 | | - <li><a class="dropdown-item" href="?history=14">Last two weeks</a></li> |
15 | | - <li><a class="dropdown-item" href="?history=21">Last three weeks</a></li> |
16 | | - <li><a class="dropdown-item" href="?history=30">Last month</a></li> |
| 36 | + <li><a class="dropdown-item" href="?history=7#byday">Last week</a></li> |
| 37 | + <li><a class="dropdown-item" href="?history=14#byday">Last two weeks</a></li> |
| 38 | + <li><a class="dropdown-item" href="?history=21#byday">Last three weeks</a></li> |
| 39 | + <li><a class="dropdown-item" href="?history=30#byday">Last month</a></li> |
17 | 40 | </ul> |
18 | 41 | </div> |
19 | 42 | </div> |
20 | 43 | </div> |
21 | | - </div> |
22 | | -</div> |
23 | | -<div class="row"> |
24 | | - <div class="col"> |
25 | 44 | <table class="table table-sm table-striped table-hover"> |
26 | 45 | <thead> |
27 | 46 | <tr> |
|
33 | 52 | </tr> |
34 | 53 | </thead> |
35 | 54 | <tbody> |
36 | | - @foreach (var item in Model.PageViews) |
| 55 | + @foreach (var item in Model.PageViewsByDay) |
37 | 56 | { |
38 | 57 | <tr> |
39 | 58 | <td>@item.Id</td> |
|
46 | 65 | </tbody> |
47 | 66 | </table> |
48 | 67 | </div> |
| 68 | + <div class="tab-pane fade" id="bysite" role="tabpanel" aria-labelledby="bysite-tab"> |
| 69 | + <div class="form-group d-inline-flex float-end mb-1"> |
| 70 | + <div class="btn-group"> |
| 71 | + <div class="dropdown order-md-1"> |
| 72 | + <button type="button" class="btn btn-secondary btn-sm dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> |
| 73 | + @GetDropDownButtonText() |
| 74 | + </button> |
| 75 | + <ul class="dropdown-menu"> |
| 76 | + <li><a class="dropdown-item" href="?history=7#bysite">Last week</a></li> |
| 77 | + <li><a class="dropdown-item" href="?history=14#bysite">Last two weeks</a></li> |
| 78 | + <li><a class="dropdown-item" href="?history=21#bysite">Last three weeks</a></li> |
| 79 | + <li><a class="dropdown-item" href="?history=30#bysite">Last month</a></li> |
| 80 | + <li><a class="dropdown-item" href="?history=0#bysite">Since ever</a></li> |
| 81 | + </ul> |
| 82 | + </div> |
| 83 | + </div> |
| 84 | + </div> |
| 85 | + <table class="table table-sm table-striped table-hover"> |
| 86 | + <thead> |
| 87 | + <tr> |
| 88 | + <th>ContentItemId</th> |
| 89 | + <th>Page Title</th> |
| 90 | + <th>Route</th> |
| 91 | + <th>Views</th> |
| 92 | + <th>Bot Views</th> |
| 93 | + <th>Unique Visitors</th> |
| 94 | + </tr> |
| 95 | + </thead> |
| 96 | + <tbody> |
| 97 | + @foreach (var item in Model.PageViewsBySite) |
| 98 | + { |
| 99 | + <tr> |
| 100 | + <td>@item.ContentItemId</td> |
| 101 | + <td>@item.DisplayText</td> |
| 102 | + <td>/@item.Route.Path</td> |
| 103 | + <td>@item.TotalViews</td> |
| 104 | + <td>@item.BotViews</td> |
| 105 | + <td>@item.UniqueVisitors</td> |
| 106 | + </tr> |
| 107 | + } |
| 108 | + </tbody> |
| 109 | + </table> |
| 110 | + </div> |
49 | 111 | </div> |
| 112 | + |
| 113 | +<script at="Foot"> |
| 114 | + $('document').ready(function () { |
| 115 | + let selectedTab = window.location.hash; |
| 116 | + let tabTrigger = new bootstrap.Tab($('.nav-link[href="' + selectedTab + '"]:first')); |
| 117 | + tabTrigger.show(); |
| 118 | + }); |
| 119 | +</script> |
0 commit comments