diff --git a/app/views/spree/users/_orders.html.haml b/app/views/spree/users/_orders.html.haml index e0b5d21066..a8c34b22f1 100644 --- a/app/views/spree/users/_orders.html.haml +++ b/app/views/spree/users/_orders.html.haml @@ -1,10 +1,10 @@ %script{ type: "text/ng-template", id: "account/orders.html" } .orders{"ng-controller" => "OrdersCtrl", "ng-cloak" => true} .my-open-orders{ ng: { show: 'Orders.changeable.length > 0' } } - %h3= t(:open_orders) + %h3= t('.open_orders') = render 'open_orders' - .past-orders - %h3= t(:past_orders) - -# = render 'past_orders' + .past-orders{ ng: { show: 'pastOrders.length > 0' } } + %h3= t('.past_orders') + = render 'past_orders' .message{"ng-if" => "Orders.all.length == 0", "ng-bind" => "::'you_have_no_orders_yet' | t"} diff --git a/app/views/spree/users/_past_orders.html.haml b/app/views/spree/users/_past_orders.html.haml new file mode 100644 index 0000000000..2abf5a273e --- /dev/null +++ b/app/views/spree/users/_past_orders.html.haml @@ -0,0 +1,22 @@ +.row + .small-12.columns + %table + %tr + %th.order1= t('.order') + %th.order2= t('.shop') + %th.order3.show-for-large-up= t('.completed_at') + %th.order4.show-for-large-up= t('.items') + %th.order5.text-right= t('.total') + %th.order6.text-right.show-for-large-up= t('.paid?') + %th.order7.text-right= t('.view') + %tbody.transaction-group{"ng-repeat" => "order in Orders.all | filter:{changes_allowed:false} as pastOrders", "ng-class-odd"=>"'odd'", "ng-class-even"=>"'even'"} + %tr.order-row + %td.order1 + %a{"ng-href" => "{{::order.path}}", "ng-bind" => "::order.number"} + %td.order2{"ng-bind" => "::Orders.shopsByID[order.shop_id].name"} + %td.order3.show-for-large-up{"ng-bind" => "::order.completed_at"} + %td.order4.show-for-large-up{"ng-bind" => "::order.item_count"} + %td.order5.text-right{"ng-class" => "{'debit': order.payment_state != 'paid', 'credit': order.payment_state == 'paid'}","ng-bind" => "::order.total | localizeCurrency"} + %td.order6.text-right.show-for-large-up{"ng-class" => "{'debit': order.payment_state != 'paid', 'credit': order.payment_state == 'paid'}", "ng-bind" => "::(order.payment_state == 'paid' ? 'say_yes' : 'say_no') | t"} + %td.order7.text-right + %a{"ng-href" => "{{::order.path}}" }= t('.view') diff --git a/config/locales/en.yml b/config/locales/en.yml index ae1cdbebcd..2db4e1b234 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2188,13 +2188,16 @@ Please follow the instructions there to make your enterprise visible on the Open zipcode: Postcode users: show: - open_orders: Open Orders - transaction_history: Transaction History tabs: orders: Orders cards: Credit Cards transactions: Transactions details: Details + orders: + open_orders: Open Orders + past_orders: Past Orders + transactions: + transaction_history: Transaction History open_orders: order: Order shop: Shop @@ -2205,3 +2208,11 @@ Please follow the instructions there to make your enterprise visible on the Open cancel: Cancel closed: Closed until: Until + past_orders: + order: Order + shop: Shop + completed_at: Completed At + items: Items + total: Total + paid?: Paid? + view: View diff --git a/spec/features/consumer/account_spec.rb b/spec/features/consumer/account_spec.rb index 8aa2d7b4be..3e30bb4cd7 100644 --- a/spec/features/consumer/account_spec.rb +++ b/spec/features/consumer/account_spec.rb @@ -38,8 +38,20 @@ feature %q{ visit "/account" # No distributors allow changes to orders - expect(page).to_not have_content I18n.t('spree.users.show.open_orders') + expect(page).to_not have_content I18n.t('spree.users.orders.open_orders') + expect(page).to have_content I18n.t('spree.users.orders.past_orders') + + # Doesn't show orders from the special Accounts & Billing distributor + expect(page).not_to have_content accounts_distributor.name + + # Lists all other orders + expect(page).to have_content d1o1.number.to_s + expect(page).to have_content d1o2.number.to_s + expect(page).to have_content d2o1.number.to_s + expect(page).to have_content credit_order.number.to_s + + # Viewing transaction history click_link I18n.t('spree.users.show.tabs.transactions') # It shows all hubs that have been ordered from with balance or credit @@ -67,7 +79,7 @@ feature %q{ it "shows such orders in a section labelled 'Open Orders'" do visit '/account' - expect(page).to have_content I18n.t('spree.users.show.open_orders') + expect(page).to have_content I18n.t('spree.users.orders.open_orders') expect(page).to have_link d1o1.number, href: spree.order_path(d1o1) expect(page).to have_link d1o2.number, href: spree.order_path(d1o2)