diff --git a/app/assets/javascripts/darkswarm/controllers/orders_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/orders_controller.js.coffee index f30cfa8436..3b45a2905f 100644 --- a/app/assets/javascripts/darkswarm/controllers/orders_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/orders_controller.js.coffee @@ -1,8 +1,8 @@ Darkswarm.controller "OrdersCtrl", ($scope, $rootScope, $timeout, Orders, Search, $document, HashNavigation, FilterSelectorsService, EnterpriseModal, enterpriseMatchesNameQueryFilter, distanceWithinKmFilter) -> $scope.Orders = Orders - $scope.filterEnterprises = -> - es = Enterprises.hubs - $scope.nameMatches = enterpriseMatchesNameQueryFilter(es, true) - $scope.distanceMatches = enterpriseMatchesNameQueryFilter(es, false) - $scope.distanceMatches = distanceWithinKmFilter($scope.distanceMatches, 50) + # $scope.filterEnterprises = -> + # es = Enterprises.hubs + # $scope.nameMatches = enterpriseMatchesNameQueryFilter(es, true) + # $scope.distanceMatches = enterpriseMatchesNameQueryFilter(es, false) + # $scope.distanceMatches = distanceWithinKmFilter($scope.distanceMatches, 50) diff --git a/app/assets/javascripts/darkswarm/services/orders.js.coffee b/app/assets/javascripts/darkswarm/services/orders.js.coffee index baa46a3d96..6c0d74cf2d 100644 --- a/app/assets/javascripts/darkswarm/services/orders.js.coffee +++ b/app/assets/javascripts/darkswarm/services/orders.js.coffee @@ -6,9 +6,11 @@ Darkswarm.factory 'Orders', (orders_by_distributor, currencyConfig, CurrentHub, @currency_symbol = currencyConfig.symbol for distributor in @orders_by_distributor - console.log distributor - for order, i in distributor.distributed_orders - balances = distributor.distributed_orders.slice(i,distributor.distributed_orders.length).map (o) -> parseFloat(o.outstanding_balance) - running_balance = balances.reduce (a,b) -> a+b - order.running_balance = running_balance.toFixed(2) - console.log order + @updateRunningBalance(distributor.distributed_orders) + + + updateRunningBalance: (orders) -> + for order, i in orders + balances = orders.slice(i,orders.length).map (o) -> parseFloat(o.outstanding_balance) + running_balance = balances.reduce (a,b) -> a+b + order.running_balance = running_balance.toFixed(2) diff --git a/app/assets/stylesheets/darkswarm/account.css.sass b/app/assets/stylesheets/darkswarm/account.css.sass index 29f9e33095..9b659c5fd9 100644 --- a/app/assets/stylesheets/darkswarm/account.css.sass +++ b/app/assets/stylesheets/darkswarm/account.css.sass @@ -14,11 +14,10 @@ &:hover, &:active, &:focus color: $clr-brick-med-bright - .account-logo - img - display: block - width: 60px - height: 60px + img + display: block + width: 80px + height: auto .credit color: green @@ -29,6 +28,9 @@ .distributor-balance.paid visibility: hidden + .transaction-group + + table border-radius: 0.5em 0.5em 0 0 tr:nth-of-type(even) @@ -39,14 +41,16 @@ border: none // Column widths for order table .order1 - width: 25% + width: 20% .order2 width: 20% .order3 - width: 25% + width: 20% .order4 width: 10% .order5 width: 10% .order6 width: 10% + .order7 + width: 10% diff --git a/app/views/spree/users/_fat.html.haml b/app/views/spree/users/_fat.html.haml index b4000ca594..fd99e325ac 100644 --- a/app/views/spree/users/_fat.html.haml +++ b/app/views/spree/users/_fat.html.haml @@ -1,29 +1,30 @@ .row.active_table_row{"ng-if" => "open()","ng-class" => "{'open' : !ofn-i_032-closed-sign()}"} - .columns.small-12.large-10.large-offset-2.fat - %table - %tr - %th.order1{"bo-text" => "'transaction' | t"} - %th.order2{"bo-text" => "'transaction_date' | t"} - %th.order3{"bo-text" => "'payment_state' | t"} - %th.order4{"bo-text" => "'shipping_state' | t"} - %th.order5.text-right{"bo-text" => "'value' | t"} - %th.order6.text-right{"bo-text" => "'balance' | t"} - %th.order6.text-right{"bo-text" => "'running_balance' | t"} - %tbody.transaction-group{"ng-repeat" => "order in distributor.distributed_orders", "ng-class-odd"=>"'odd'", "ng-class-even"=>"'even'"} - %tr.order-row - %td.order1 - %a{"bo-href" => "order.path", "bo-text" => "('order' | t )+ ' ' + order.number"} - %td.order2{"bo-text" => "order.completed_at"} - %td.order3{"bo-text" => "order.payment_state | t"} - %td.order4{"bo-text" => "order.shipment_state | t"} - %td.order5.text-right{"bo-text" => "order.total | localizeCurrency"} - %td.order6.text-right{"ng-class" => "{'credit' : order.outstanding_balance < 0, 'debit' : order.outstanding_balance > 0, 'paid' : order.outstanding_balance == 0}", "bo-text" => "order.outstanding_balance | localizeCurrency"} - %td.order7.text-right{"ng-class" => "{'credit' : order.running_balance < 0, 'debit' : order.running_balance > 0, 'paid' : order.running_balance == 0}", "bo-text" => "order.running_balance | localizeCurrency"} - %tr.payment-row{"ng-repeat" => "payment in order.payments"} - %td.order1{"bo-text" => "()'payment' | t) + ' ' + payment.identifier"} - %td.order2{"bo-text" => "payment.updated_at"} - %td.order3{"bo-text" => "payment.payment_method"} - %td.order4 - %td.order5.text-right{"bo-text" => "payment.amount | localizeCurrency"} - %td.order6 - %td.order7 + .columns.small-12.fat + .row + %table + %tr + %th.order1{"bo-text" => "'transaction' | t"} + %th.order2{"bo-text" => "'transaction_date' | t"} + %th.order3.show-for-large-up{"bo-text" => "'payment_state' | t"} + %th.order4.show-for-large-up{"bo-text" => "'shipping_state' | t"} + %th.order5.text-right{"bo-text" => "'value' | t"} + %th.order6.text-right.show-for-large-up{"bo-text" => "'outstanding_balance' | t"} + %th.order7.text-right{"bo-text" => "'running_balance' | t"} + %tbody.transaction-group{"ng-repeat" => "order in distributor.distributed_orders", "ng-class-odd"=>"'odd'", "ng-class-even"=>"'even'"} + %tr.order-row + %td.order1 + %a{"bo-href" => "order.path", "bo-text" => "('order' | t )+ ' ' + order.number"} + %td.order2{"bo-text" => "order.completed_at"} + %td.order3.show-for-large-up{"bo-text" => "order.payment_state | t"} + %td.order4.show-for-large-up{"bo-text" => "order.shipment_state | t"} + %td.order5.text-right{"bo-text" => "order.total | localizeCurrency"} + %td.order6.text-right.show-for-large-up{"ng-class" => "{'credit' : order.outstanding_balance < 0, 'debit' : order.outstanding_balance > 0, 'paid' : order.outstanding_balance == 0}", "bo-text" => "order.outstanding_balance | localizeCurrency"} + %td.order7.text-right{"ng-class" => "{'credit' : order.running_balance < 0, 'debit' : order.running_balance > 0, 'paid' : order.running_balance == 0}", "bo-text" => "order.running_balance | localizeCurrency"} + %tr.payment-row{"ng-repeat" => "payment in order.payments"} + %td.order1{"bo-text" => "('payment' | t)"} + %td.order2{"bo-text" => "payment.updated_at"} + %td.order3.show-for-large-up{"bo-text" => "payment.payment_method"} + %td.order4.show-for-large-up + %td.order5.text-right{"bo-text" => "payment.amount | localizeCurrency"} + %td.order6.show-for-large-up + %td.order7 diff --git a/app/views/spree/users/_skinny.html.haml b/app/views/spree/users/_skinny.html.haml index 5310f06a63..baec2f4e7a 100644 --- a/app/views/spree/users/_skinny.html.haml +++ b/app/views/spree/users/_skinny.html.haml @@ -5,7 +5,7 @@ .columns.small-10.medium-5 %span.margin-top %strong{"bo-text" => "distributor.name"} - .columns.small-8.small-offset-2.medium-3 + .columns.small-8.small-offset-2.medium-3.text-right %span.margin-top.distributor-balance{"bo-text" => "distributor.balance | formatBalance", "ng-class" => "{'credit' : distributor.balance < 0, 'debit' : distributor.balance > 0, 'paid' : distributor.balance == 0}" } -# %span.margin-top{"bo-text" => "('balance' | t) + ': ' + Orders.currency_symbol + distributor.balance", "ng-class" => "{'credit' : order.outstanding_balance < 0, 'debit' : order.outstanding_balance > 0, 'paid' : order.outstanding_balance == 0}"} .columns.small-2.medium-2.text-right diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml index 01475462e0..b2e1d8d96c 100644 --- a/config/locales/en-GB.yml +++ b/config/locales/en-GB.yml @@ -635,4 +635,3 @@ Please follow the instructions there to make your enterprise visible on the Open price_graph: "Price graph" included_tax: "Included tax" remove_tax: "Remove tax" - balance: "Balance" diff --git a/config/locales/en.yml b/config/locales/en.yml index a1675f951b..5b7f2ed5cd 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -681,10 +681,10 @@ Please follow the instructions there to make your enterprise visible on the Open payment_state: "Payment status" shipping_state: "Shipping status" value: "Value" - "Balance due": "Balance due" # TODO: In /accounts better to pass the symbol and translate rather than humanize balance_due: "Balance due" credit: "Credit" Paid: "Paid" Ready: "Ready" you_have_no_orders_yet: "You have no orders yet" running_balance: "Running balance" + outstanding_balance: "Outstanding balance"