Skip to content
This repository has been archived by the owner on Oct 8, 2019. It is now read-only.

Commit

Permalink
feat(SFOX): add pending trades to checkout page
Browse files Browse the repository at this point in the history
  • Loading branch information
plondon committed Apr 23, 2018
1 parent 390fb7c commit 7aae2cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/partials/sfox/checkout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,18 @@ bc-tabs(tab="tabs.selectedTab" tab-options="tabs.options" on-select="tabs.select
trade-account="checkout.state.account"
handle-quote="sellQuoteHandler(amount, baseCurr, quoteCurr)"
on-success="selling().verificationRequired ? checkout.openSfoxSignup() : buildPayment(quote)")
.flex-column.width-50.pl-30.prn.pv-10-mobile.no-margin-mobile.hidden-xs(ng-if="checkout.onStep('create') && !checkout.hasDismissedSellIntro()")
.flex-column.width-50.pl-30.prn.pv-10-mobile.no-margin-mobile.hidden-xs(ng-if="checkout.onStep('create') && !checkout.hasDismissedSellIntro() && !pendingSellTrades().length")
.flex-between
span.f-24.blue.f-14-mobile
i.icon-buy-sell.h3.mrm
span(translate="SFOX.sell.INTRODUCING_HEADER")
span
i.pointer.ti-close.f-14.mid-grey(ng-click="checkout.dismissSellIntro()")
p.f-12.mt-10(translate="SFOX.sell.INTRODUCING_BODY")
.width-50.pl-30.prn.pv-10-mobile.no-margin-mobile(ng-if="pendingSellTrades().length")
span You have {{ pendingSellTrades().length }} pending sell {{ pendingSellTrades().length === 1 ? 'transaction' : 'transactions' }} for a total of {{ pendingSellTradesTotal() }} USD. You can see more details in your
|  
a(ng-click="tabs.select('ORDER_HISTORY')") Order History.
.flex-row.pbvl(ng-if="checkout.onStep('confirm')")
exchange-confirm.width-55.border-desktop(
type="checkout.type"
Expand Down
2 changes: 2 additions & 0 deletions assets/js/controllers/sfox/sfoxCheckout.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ function SfoxCheckoutController ($scope, $timeout, $stateParams, $q, Wallet, MyW

$scope.showBuy = () => MyWallet.wallet.accountInfo.invited.sfoxBuy;
$scope.pendingBuyTrades = () => $scope.pendingTrades().filter((t) => t.isBuy);
$scope.pendingSellTrades = () => $scope.pendingTrades().filter((t) => !t.isBuy);
$scope.pendingBuyTradesTotal = () => $scope.pendingBuyTrades().map((t) => t.receiveAmount).reduce((acc, amt) => acc + amt);
$scope.pendingSellTradesTotal = () => $scope.pendingSellTrades().map((t) => t.receiveAmount).reduce((acc, amt) => acc + amt).toFixed(2);

this.handleCancel = (skipConfirm, type, step) => {
if (skipConfirm) $scope.checkout.goTo('create');
Expand Down

0 comments on commit 7aae2cc

Please sign in to comment.