Skip to content

Commit

Permalink
UI Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
leowyy committed Apr 14, 2017
1 parent 7be9019 commit 1172904
Show file tree
Hide file tree
Showing 33 changed files with 34 additions and 3,509 deletions.
39 changes: 1 addition & 38 deletions app-main/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ angular
name:'sbAdminApp',
files:[
'scripts/controllers/main.js',
'scripts/directives/timeline/timeline.js',
'scripts/directives/notifications/notifications.js',
'scripts/directives/chat/chat.js',
'scripts/directives/dashboard/stats/stats.js',
'scripts/services/transaction-service.js',
'scripts/services/prediction-service.js'
Expand All @@ -121,9 +118,6 @@ angular
name:'sbAdminApp',
files:[
'scripts/controllers/main.js',
'scripts/directives/timeline/timeline.js',
'scripts/directives/notifications/notifications.js',
'scripts/directives/chat/chat.js',
'scripts/directives/dashboard/stats/stats.js',
'scripts/services/transaction-service.js',
'scripts/controllers/chartContoller.js',
Expand Down Expand Up @@ -208,6 +202,7 @@ angular
url:'/Completed',
templateUrl:'views/MyTransactions/Completed.html',
controller: 'CompletedCtrl',
params: {txSent: false, txDetails: null },
resolve: {
loadMyFile:function($ocLazyLoad) {
return $ocLazyLoad.load({
Expand Down Expand Up @@ -252,10 +247,6 @@ angular
url:'/Profile',
templateUrl:'views/user_profile/Profile.html'
})
.state('dashboard.form',{
templateUrl:'views/form.html',
url:'/form'
})
.state('dashboard.chart',{
templateUrl:'views/chart.html',
url:'/chart',
Expand All @@ -276,32 +267,4 @@ angular
}
}
})
.state('dashboard.table',{
templateUrl:'views/table.html',
url:'/table'
})
.state('dashboard.panels-wells',{
templateUrl:'views/ui-elements/panels-wells.html',
url:'/panels-wells'
})
.state('dashboard.buttons',{
templateUrl:'views/ui-elements/buttons.html',
url:'/buttons'
})
.state('dashboard.notifications',{
templateUrl:'views/ui-elements/notifications.html',
url:'/notifications'
})
.state('dashboard.typography',{
templateUrl:'views/ui-elements/typography.html',
url:'/typography'
})
.state('dashboard.icons',{
templateUrl:'views/ui-elements/icons.html',
url:'/icons'
})
.state('dashboard.grid',{
templateUrl:'views/ui-elements/grid.html',
url:'/grid'
})
}]);
13 changes: 10 additions & 3 deletions app-main/scripts/controllers/Completed.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Controller of the sbAdminApp
*/
angular.module('sbAdminApp')
.controller('CompletedCtrl', ['$scope', '$interval', 'txService' ,function($scope, $interval, txService) {
.controller('CompletedCtrl', ['$scope', '$interval', 'txService', '$stateParams' ,function($scope, $interval, txService, $stateParams) {
console.log("loaded");
$scope.balance = 0;

Expand All @@ -31,11 +31,11 @@ angular.module('sbAdminApp')
});
txService.getBought(function(txs) {
$scope.tempBought = $scope.tempBought.concat(txs);
$scope.bought = $scope.tempBought;
$scope.bought = $scope.tempBought.filter($scope.filterOutDonations);
});
txService.getSold(function(txs) {
$scope.tempSold = $scope.tempSold.concat(txs);
$scope.sold = $scope.tempSold;
$scope.sold = $scope.tempSold.filter($scope.filterOutDonations);
});
}

Expand All @@ -52,4 +52,11 @@ angular.module('sbAdminApp')
}, 3000)
reloadData();

$scope.txAlert = $stateParams.txSent;
$scope.txDetails = $stateParams.txDetails;

$scope.closeTxAlert = function(index) {
$scope.txAlert = false;
};

}]);
15 changes: 8 additions & 7 deletions app-main/scripts/controllers/Donations.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ angular.module('sbAdminApp')
}
$scope.accepts = txs.pendingAccepts.concat(txs.successfulAccepts);
$scope.agrees = txs.offersAccepted;
/*
for (var i = 0; i<txs.pendingAgrees.length; i++) {
txs.pendingAgrees[i].agreeing = true;
txs.pendingAgrees[i].pending = true;
}
*/

for (var i = 0; i<txs.offersAccepted.length; i++) {
txs.offersAccepted[i].agreeing = true;
}
Expand All @@ -44,7 +39,7 @@ angular.module('sbAdminApp')
$scope.tempDonationsCompleted.push(txs.pendingAgrees[i]);
}
}
//$scope.agrees = txs.pendingAgrees.concat(txs.offersAccepted);

$scope.offers = $scope.offers.concat($scope.agrees);
// Get donations
$scope.donations = $scope.offers.filter($scope.getDonations);
Expand Down Expand Up @@ -93,6 +88,12 @@ angular.module('sbAdminApp')
$scope.txAlert = false;
};

$scope.completeAlert = false;

$scope.closeTxAlert = function(index) {
$scope.completeAlert = false;
};

$scope.agree = function(uuid) {
txService.agree(uuid, function(response) {
console.log("Agree sent");
Expand Down
59 changes: 3 additions & 56 deletions app-main/scripts/controllers/InProgress.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,11 @@ angular.module('sbAdminApp')
}
$scope.accepts = txs.pendingAccepts.concat(txs.successfulAccepts);
$scope.agrees = txs.offersAccepted;
/*
for (var i = 0; i<txs.pendingAgrees.length; i++) {
txs.pendingAgrees[i].agreeing = true;
txs.pendingAgrees[i].pending = true;
}
*/

for (var i = 0; i<txs.offersAccepted.length; i++) {
txs.offersAccepted[i].agreeing = true;
}
//$scope.agrees = txs.pendingAgrees.concat(txs.offersAccepted);

$scope.offers = $scope.offers.concat($scope.agrees);

// Filter out donations
Expand All @@ -44,54 +39,6 @@ angular.module('sbAdminApp')
$scope.offers = $scope.offers.filter($scope.filterOutDonations);
$scope.reloaded = true;

}, function() {
//add mock data here when server not running
$scope.offers = [{
sell: true,
item: "Orange",
quantity: 100,
price: 2,
accepter: {
name: "ShengSiong"
},
agreeing: true,
transportCost: 123
},{
sell: true,
item: "Mango",
quantity: 120,
price: 2,
},{
sell: true,
item: "Banana",
quantity: 200,
price: 2,
},{
sell: false,
item: "Mango",
quantity: 110,
price: 3,
},{
sell: false,
item: "Apple",
quantity: 100,
price: 2,
accepter: {
name: "ShengSiong"
},
agreeing: true,
transportCost: 123
}]; //Offers you made

$scope.accepts = [{
sell: true,
item: "Mango",
quantity: 120,
price: 2,
}
]; //Offers that you accepted and waiting for other party to agree
$scope.agrees = []; //Offers accepted waiting for you to agree, or agreed but not included in block chain

})
$scope.reloaded = true;
};
Expand Down Expand Up @@ -140,7 +87,7 @@ angular.module('sbAdminApp')
console.log("Agree sent");
$scope.reloaded = false;
$('.modal-backdrop').remove();
$state.go('dashboard.Completed');
$state.go('dashboard.Completed', {txSent: true, txDetails: $scope.txView.item });
}, function() {
$scope.alert = true;
})
Expand Down
3 changes: 2 additions & 1 deletion app-main/scripts/controllers/MyPredictions.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ angular.module('sbAdminApp')
var predictions = $scope.demand;
var paddingLeft = [null,null,null,null,null,null,null];
var predictionChart = new Chart(ctx).Line({
labels: ["Apr 7", "", "Apr 9", "", "Apr 11", "", "Apr 13", "", "Apr 15", "", "Apr 17", "", "Apr 19", "", "Apr 21", "", "Apr 23", "", "Apr 25", "", "Apr 27"],
labels: ["Apr 7", "", "Apr 9", "", "Apr 11", "", "Apr 13", "", "Apr 15", "", "Apr 17", "", "Apr 19",
"", "Apr 21", "", "Apr 23", "", "Apr 25", "", "Apr 27"],
datasets: [
{
// plotting past demand
Expand Down
24 changes: 0 additions & 24 deletions app-main/scripts/controllers/chartContoller.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,32 +47,8 @@ angular.module('sbAdminApp')
]
};

$scope.pie = {
labels : ["Download Sales", "In-Store Sales", "Mail-Order Sales"],
data : [300, 500, 100]
};

$scope.polar = {
labels : ["Download Sales", "In-Store Sales", "Mail-Order Sales", "Tele Sales", "Corporate Sales"],
data : [300, 500, 100, 40, 120]
};

$scope.dynamic = {
labels : ["Download Sales", "In-Store Sales", "Mail-Order Sales", "Tele Sales", "Corporate Sales"],
data : [300, 500, 100, 40, 120],
type : 'PolarArea',

toggle : function ()
{
this.type = this.type === 'PolarArea' ?
'Pie' : 'PolarArea';
}
};
$scope.donutcolours = ["#2DBAD5", "#66CD00", "#DB2929"];
$scope.radarcolours = ["#66CD00", "#EE0000"];
$scope.lineMonthColours = ["#2DBAD5", "#66CD00", "#EE0000"];

/*["rgba(224, 108, 112, 1)",
"rgba(224, 108, 112, 1)",
"rgba(224, 108, 112, 1)"]*/
}]);
12 changes: 0 additions & 12 deletions app-main/scripts/controllers/form.js

This file was deleted.

4 changes: 0 additions & 4 deletions app-main/scripts/controllers/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ angular.module('sbAdminApp')
.controller('MainCtrl', ['$scope', '$interval', 'txService', 'predictionService', function($scope, $interval, txService, predictionService) {
console.log("main controller loaded");
$scope.balance = 0;
$scope.donut = {
labels: ["Download Sales", "In-Store Sales", "Mail-Order Sales"],
data: [300, 500, 100]
};

var reloadData = function() {
txService.getEther(function(balance) {
Expand Down
Loading

0 comments on commit 1172904

Please sign in to comment.