diff --git a/app/assets/javascripts/listSort.js b/app/assets/javascripts/listSort.js index c56cf55d..fd97d460 100644 --- a/app/assets/javascripts/listSort.js +++ b/app/assets/javascripts/listSort.js @@ -21,10 +21,10 @@ $(document).on('turbolinks:load ajax:loaded', function(){ var paymentOptions = { valueNames: [ - { name: 'bill_description', attr: 'data-sort-bill_description' }, - { name: 'item_title', attr: 'data-sort-item_title' }, + { name: 'nice_status', attr: 'data-sort-nice_status' }, + { name: 'title', attr: 'data-sort-title' }, { name: 'payment_date', attr: 'data-sort-payment_date' }, - { name: 'bill_amount', attr: 'data-sort-bill_amount'}, + { name: 'fee', attr: 'data-sort-fee'}, ], }; diff --git a/app/models/folio/account.rb b/app/models/folio/account.rb index a769afb0..759991d4 100644 --- a/app/models/folio/account.rb +++ b/app/models/folio/account.rb @@ -102,11 +102,11 @@ def sort_key(key) sort_key = case key when :payment_date [payment_sort_key, title, nice_status] - when :item_title + when :title [title, payment_sort_key, nice_status] - when :bill_amount + when :fee [fee, payment_sort_key, title, nice_status] - when :bill_description + when :nice_status [nice_status, payment_sort_key, title] end @@ -126,15 +126,6 @@ def payment_amount UNPAID_STATUSES.include?(status) ? 0 : fee end - # Methods on Symphony::Payment - # TODO: remove these after migration and consolidate method names - alias resolution status - alias bill_description nice_status - alias nice_bill_description nice_status - alias item_title title - alias paid_fee? closed? - alias bill_amount fee - private def record_location diff --git a/app/views/payments/_payment.html.erb b/app/views/payments/_payment.html.erb index be8fe97c..04550823 100644 --- a/app/views/payments/_payment.html.erb +++ b/app/views/payments/_payment.html.erb @@ -1,20 +1,20 @@
  • -
    - <%= payment.nice_bill_description %> +
    + <%= payment.nice_status %>
    -
    - <%= number_to_currency(payment.bill_amount) %> +
    + <%= number_to_currency(payment.fee) %>
    <%= l(payment.payment_date, format: :short) %>
    -
    -

    <%= payment.item_title %>

    +
    +

    <%= payment.title %>

    @@ -23,12 +23,12 @@ <% if @payments.any? %>
    -
    Reason
    -
    Amount
    +
    Reason
    +
    Amount
    Paid on
    -
    Title
    +
    Title
    diff --git a/spec/features/payments_spec.rb b/spec/features/payments_spec.rb index 61278569..b0118285 100644 --- a/spec/features/payments_spec.rb +++ b/spec/features/payments_spec.rb @@ -30,7 +30,7 @@ expect(page).to have_css('li h3', text: 'Aspects of twentieth century art : Picasso - Important paintings, ' \ 'watercolours, and new linocuts.') - expect(page).to have_css('li .bill_description', text: 'Lost item fee') + expect(page).to have_css('li .nice_status', text: 'Lost item fee') end end @@ -53,13 +53,13 @@ within '#payments' do expect(page).to have_css('.dropdown-toggle', text: 'Sort (Date paid)') - find('[data-sort="bill_description"]').click + find('[data-sort="nice_status"]').click expect(page).to have_css('.dropdown-toggle', text: 'Sort (Reason)') - expect(page).to have_css('.active[data-sort="bill_description"]', count: 2, visible: :all) + expect(page).to have_css('.active[data-sort="nice_status"]', count: 2, visible: :all) within(first('ul.payments li')) do - expect(page).to have_css('.bill_description', text: 'Damaged material') + expect(page).to have_css('.nice_status', text: 'Damaged material') end end end