mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Showing past orders under the orders tab
This commit is contained in:
@@ -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"}
|
||||
|
||||
22
app/views/spree/users/_past_orders.html.haml
Normal file
22
app/views/spree/users/_past_orders.html.haml
Normal file
@@ -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')
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user