From abd6ccea746844d9ad9e5d73d1d2f9b330254430 Mon Sep 17 00:00:00 2001 From: GloriousCode Date: Mon, 6 Mar 2017 19:55:18 +1100 Subject: [PATCH] Implements front-end call for buy and sell orders Copy-pastes sell-orders component for mass component creation --- web/app/app.js | 1 + web/app/components/buy-orders/buy-orders.js | 11 ++-- .../enabled-exchanges/enabled-exchanges.html | 4 +- .../components/sell-orders/sell-orders.css | 12 +++++ .../components/sell-orders/sell-orders.html | 25 +++++++++ web/app/components/sell-orders/sell-orders.js | 52 +++++++++++++++++++ web/app/index.html | 1 + web/app/views/home/home.html | 8 +-- 8 files changed, 104 insertions(+), 10 deletions(-) create mode 100644 web/app/components/sell-orders/sell-orders.css create mode 100644 web/app/components/sell-orders/sell-orders.html create mode 100644 web/app/components/sell-orders/sell-orders.js diff --git a/web/app/app.js b/web/app/app.js index 2d100f75..30de9f59 100644 --- a/web/app/app.js +++ b/web/app/app.js @@ -12,6 +12,7 @@ angular.module('myApp', [ 'myApp.sell', 'myApp.enabledExchanges', 'myApp.buyOrders', + 'myApp.sellOrders', 'myApp.stringUtils' ]). config(['$locationProvider', '$routeProvider', 'NotificationProvider', function($locationProvider, $routeProvider, NotificationProvider) { diff --git a/web/app/components/buy-orders/buy-orders.js b/web/app/components/buy-orders/buy-orders.js index 9f742535..77dd3cba 100644 --- a/web/app/components/buy-orders/buy-orders.js +++ b/web/app/components/buy-orders/buy-orders.js @@ -11,11 +11,15 @@ angular.module('myApp.buyOrders',[]).component('buyorders', { $scope.exchange = args.Exchange; $scope.currencyOne = $scope.currency.FirstCurrency; $scope.currencyTwo = $scope.currency.SecondCurrency; - $scope.doTheThing(); + $scope.getRecentBuyOrders(); }); - $scope.doTheThing = function() { - $scope.buyOrders = [ + $scope.getRecentBuyOrders = function() { + var exchData = {params : {exchangeName: '', currencyPair:''}}; + $http.get('/GetBuyOrdersForCurrencyPair' , exchData).success(function(data) { + $scope.buyOrders = data; + }).error(function() { + $scope.buyOrders = [ {price:12,currencyOneAmount:12,currencyTwoAmount:13,sum:1111}, {price:13,currencyOneAmount:15,currencyTwoAmount:13,sum:11231}, {price:14,currencyOneAmount:232,currencyTwoAmount:13,sum:4511}, @@ -38,6 +42,7 @@ angular.module('myApp.buyOrders',[]).component('buyorders', { {price:17,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, {price:17,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, ]; + }); } } diff --git a/web/app/components/enabled-exchanges/enabled-exchanges.html b/web/app/components/enabled-exchanges/enabled-exchanges.html index c55372b2..6be424b6 100644 --- a/web/app/components/enabled-exchanges/enabled-exchanges.html +++ b/web/app/components/enabled-exchanges/enabled-exchanges.html @@ -1,4 +1,3 @@ -

All enabled currencies

@@ -26,5 +25,4 @@
- - \ No newline at end of file + \ No newline at end of file diff --git a/web/app/components/sell-orders/sell-orders.css b/web/app/components/sell-orders/sell-orders.css new file mode 100644 index 00000000..d76f0485 --- /dev/null +++ b/web/app/components/sell-orders/sell-orders.css @@ -0,0 +1,12 @@ +.table-fixed-heading { + margin-bottom:0px; +} + +.buy-order-table th,.buy-order-table td { + width:25%; +} + +.buy-order-data { + max-height:200px; + overflow-y:scroll; +} \ No newline at end of file diff --git a/web/app/components/sell-orders/sell-orders.html b/web/app/components/sell-orders/sell-orders.html new file mode 100644 index 00000000..338b54ce --- /dev/null +++ b/web/app/components/sell-orders/sell-orders.html @@ -0,0 +1,25 @@ + +
+ + + + + + + + + +
Price{{currencyOne}}{{currencyTwo}}Sum({{currencyTwo}})
+
+ + + + + + + + + +
{{sellOrder.price}}{{sellOrder.currencyOneAmount}}{{sellOrder.currencyTwoAmount}}{{sellOrder.sum}}
+
+
\ No newline at end of file diff --git a/web/app/components/sell-orders/sell-orders.js b/web/app/components/sell-orders/sell-orders.js new file mode 100644 index 00000000..c2a48ca2 --- /dev/null +++ b/web/app/components/sell-orders/sell-orders.js @@ -0,0 +1,52 @@ + +angular.module('myApp.sellOrders',[]).component('sellorders', { + templateUrl: '/components/sell-orders/sell-orders.html', + controller:'SellOrdersController', + controller: function ($scope, $http, Notification, $rootScope) { + $scope.currency = {}; + $scope.exchange = {}; + + $rootScope.$on('CurrencyChanged', function (event, args) { + $scope.currency = args.Currency; + $scope.exchange = args.Exchange; + $scope.currencyOne = $scope.currency.FirstCurrency; + $scope.currencyTwo = $scope.currency.SecondCurrency; + $scope.getRecentSellOrders(); + }); + + $scope.getRecentSellOrders = function() { + var exchData = {params : {exchangeName: '', currencyPair:''}}; + $http.get('/GetSellOrdersForCurrencyPair' , exchData).success(function(data) { + $scope.sellOrders = data; + }).error(function() { + $scope.sellOrders = [ + {price:456,currencyOneAmount:12,currencyTwoAmount:13,sum:1111}, + {price:234,currencyOneAmount:15,currencyTwoAmount:13,sum:11231}, + {price:12344,currencyOneAmount:232,currencyTwoAmount:13,sum:4511}, + {price:15467,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, + {price:6717,currencyOneAmount:2452,currencyTwoAmount:13,sum:11212311}, + {price:17,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, + {price:17,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, + {price:17,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, + {price:17,currencyOneAmount:34522,currencyTwoAmount:13,sum:11212311}, + {price:17,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, + {price:17,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, + {price:17,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, + {price:17,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, + {price:17,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, + {price:17,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, + {price:17,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, + {price:17,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, + {price:17,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, + {price:17,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, + {price:17,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, + {price:17,currencyOneAmount:22,currencyTwoAmount:13,sum:11212311}, + ]; + }); + } + + } +}); + + + diff --git a/web/app/index.html b/web/app/index.html index c712067a..a7aa6939 100644 --- a/web/app/index.html +++ b/web/app/index.html @@ -69,6 +69,7 @@ + diff --git a/web/app/views/home/home.html b/web/app/views/home/home.html index 86a80215..b9ff274a 100644 --- a/web/app/views/home/home.html +++ b/web/app/views/home/home.html @@ -1,6 +1,6 @@
-
+

{{exchange.exchangeName}} Exchange

{{currency.CurrencyPair}}

@@ -9,6 +9,9 @@

Sell orders

+ + +

Buy orders

@@ -40,10 +43,7 @@
-
-
-