Skip to content

Commit

Permalink
Merge pull request #42 from ezraroi/39-add-drill-down-from-result-dit…
Browse files Browse the repository at this point in the history
…-in-dashboard-page

added bets dril down
  • Loading branch information
ezraroi authored Jun 21, 2024
2 parents 697b46a + f535321 commit 61fe09b
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 21 deletions.
31 changes: 24 additions & 7 deletions Mundialito/Client/src/Dashboard/Dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,31 @@
</div>
<div class="row">
<div class="col-md-12">
<div class="row" ng-repeat="(result,total) in resultsDict[game.GameId].results">
<div class="col-md-1 col-xs-2 text-center">
<span class="badge">{{result}}</span>
<uib-accordion close-others="oneAtATime">
<div uib-accordion-group class="panel-info" is-open="status[result].open"
ng-repeat="(result,total) in resultsDict[game.GameId].results">
<uib-accordion-heading>
<div class="row">
<div class="col-md-1 col-xs-2 text-center">
<span class="badge">{{result}}</span>
</div>
<div class="col-md-10 col-xs-9">
<uib-progressbar max="100" min="0" value="total.percent"
type="info"><span
style="color:white; white-space:nowrap;">{{total.total}}</span></uib-progressbar>
</div>
<div class="col-md-1 col-xs-1">
<i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': status[result].open, 'glyphicon-chevron-right': !status[result].open}"></i>
</div>
</div>
</uib-accordion-heading>
<div class="list-group">
<a href="/users/{{::bet.User.Username}}" class="list-group-item" ng-repeat="bet in resultsDict[game.GameId].results[result].bets">
{{bet.User.FirstName}} {{bet.User.LastName}}
</a>
</div>
</div>
<div class="col-md-11 col-xs-10">
<uib-progressbar max="100" min="0" value="total.percent" type="info"><span style="color:white; white-space:nowrap;">{{total.total}}</span></uib-progressbar>
</div>
</div>
</uib-accordion>
</div>
</div>
</div>
Expand Down
7 changes: 6 additions & 1 deletion Mundialito/Client/src/Dashboard/DashboardCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ angular.module('mundialitoApp').controller('DashboardCtrl', ['$scope', '$log', '
$scope.generalBetsAreOpen = false;
$scope.submittedGeneralBet = true;
$scope.pendingUpdateGames = false;
$scope.oneAtATime = true;
$scope.status = {};

$scope.teamsDic = {};
$scope.playersDic = {};
Expand All @@ -26,13 +28,16 @@ angular.module('mundialitoApp').controller('DashboardCtrl', ['$scope', '$log', '
BetsManager.getGameBets(game.GameId).then((data) => {
$scope.resultsDict[game.GameId] = {
total: data.length,
bets: data,
results: {}
};
data.forEach(bet => {
let result = bet.HomeScore + "-" + bet.AwayScore;
let item = $scope.resultsDict[game.GameId].results[result];
if (item === undefined) {
item = { total: 1 };
item = { total: 1,
bets: _.filter(data, (bet) => bet.HomeScore + '-' + bet.AwayScore === result)
};
} else {
item.total++;
}
Expand Down
4 changes: 0 additions & 4 deletions Mundialito/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<base href="/" />
<link rel="stylesheet" type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/patternfly/3.18.1/css/patternfly.min.css">
<link rel="stylesheet" type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/patternfly/3.18.1/css/patternfly-additions.min.css">
@if (Model.Theme == "cerulean")
{
<link href="css/app-cerulean.css" rel="stylesheet" />
Expand Down
31 changes: 24 additions & 7 deletions Mundialito/wwwroot/App/Dashboard/Dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,31 @@
</div>
<div class="row">
<div class="col-md-12">
<div class="row" ng-repeat="(result,total) in resultsDict[game.GameId].results">
<div class="col-md-1 col-xs-2 text-center">
<span class="badge">{{result}}</span>
<uib-accordion close-others="oneAtATime">
<div uib-accordion-group class="panel-info" is-open="status[result].open"
ng-repeat="(result,total) in resultsDict[game.GameId].results">
<uib-accordion-heading>
<div class="row">
<div class="col-md-1 col-xs-2 text-center">
<span class="badge">{{result}}</span>
</div>
<div class="col-md-10 col-xs-9">
<uib-progressbar max="100" min="0" value="total.percent"
type="info"><span
style="color:white; white-space:nowrap;">{{total.total}}</span></uib-progressbar>
</div>
<div class="col-md-1 col-xs-1">
<i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': status[result].open, 'glyphicon-chevron-right': !status[result].open}"></i>
</div>
</div>
</uib-accordion-heading>
<div class="list-group">
<a href="/users/{{::bet.User.Username}}" class="list-group-item" ng-repeat="bet in resultsDict[game.GameId].results[result].bets">
{{bet.User.FirstName}} {{bet.User.LastName}}
</a>
</div>
</div>
<div class="col-md-11 col-xs-10">
<uib-progressbar max="100" min="0" value="total.percent" type="info"><span style="color:white; white-space:nowrap;">{{total.total}}</span></uib-progressbar>
</div>
</div>
</uib-accordion>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion Mundialito/wwwroot/js/app-min.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion Mundialito/wwwroot/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,8 @@ angular.module('mundialitoApp').controller('DashboardCtrl', ['$scope', '$log', '
$scope.generalBetsAreOpen = false;
$scope.submittedGeneralBet = true;
$scope.pendingUpdateGames = false;
$scope.oneAtATime = true;
$scope.status = {};

$scope.teamsDic = {};
$scope.playersDic = {};
Expand All @@ -653,13 +655,16 @@ angular.module('mundialitoApp').controller('DashboardCtrl', ['$scope', '$log', '
BetsManager.getGameBets(game.GameId).then((data) => {
$scope.resultsDict[game.GameId] = {
total: data.length,
bets: data,
results: {}
};
data.forEach(bet => {
let result = bet.HomeScore + "-" + bet.AwayScore;
let item = $scope.resultsDict[game.GameId].results[result];
if (item === undefined) {
item = { total: 1 };
item = { total: 1,
bets: _.filter(data, (bet) => bet.HomeScore + '-' + bet.AwayScore === result)
};
} else {
item.total++;
}
Expand Down

0 comments on commit 61fe09b

Please sign in to comment.