mirror of https://github.com/abpframework/abp.git
8 changed files with 92 additions and 29 deletions
@ -0,0 +1,11 @@ |
|||
using System; |
|||
|
|||
namespace DashboardDemo |
|||
{ |
|||
public class CountersWidgetInputDto |
|||
{ |
|||
public DateTime StartDate { get; set; } |
|||
|
|||
public DateTime EndDate { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
namespace DashboardDemo |
|||
{ |
|||
public class CountersWidgetResultDto |
|||
{ |
|||
public int NewUsers { get; set; } |
|||
public int ActiveUsers { get; set; } |
|||
public double TotalIncome { get; set; } |
|||
public double TotalProfit { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
(function() { |
|||
|
|||
function refresh(args) { |
|||
var mainContainer = args.container; |
|||
var globalFilters = args.filters; |
|||
|
|||
mainContainer |
|||
.find('.counters-widget') |
|||
.each(function () { |
|||
var $this = $(this); |
|||
dashboardDemo.dashboard |
|||
.getCountersWidget({ |
|||
startDate: globalFilters.startDate, |
|||
endDate: globalFilters.endDate |
|||
}).then(function (result) { |
|||
$this.find('.new-user-count').text(result.newUsers); |
|||
$this.find('.active-user-count').text(result.activeUsers); |
|||
$this.find('.total-income').text('$' + result.totalIncome.toFixed(2)); |
|||
$this.find('.total-profit').text('$' + result.totalProfit.toFixed(2)); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
abp.event.on('refresh-widgets', refresh); |
|||
})(); |
|||
@ -0,0 +1,26 @@ |
|||
(function () { |
|||
|
|||
function triggerWidgets(eventName) { |
|||
abp.event.trigger( |
|||
eventName, |
|||
{ |
|||
container: $('#MyDashboardWidgetsArea'), |
|||
filters: { |
|||
startDate: $('#StartDate').val(), |
|||
endDate: $('#EndDate').val() |
|||
} |
|||
} |
|||
); |
|||
} |
|||
|
|||
$(function () { |
|||
|
|||
$('#MyDashboardFilterForm').submit(function(e) { |
|||
e.preventDefault(); |
|||
|
|||
triggerWidgets('refresh-widgets'); |
|||
}); |
|||
|
|||
triggerWidgets('init-widgets'); |
|||
}); |
|||
})(); |
|||
Loading…
Reference in new issue