Sha256: 7cae7b55f7887afe7dd8fbee175b4e1f18f72debd1cd0cd4be494f165127cfc8

Contents?: true

Size: 867 Bytes

Versions: 5

Compression:

Stored size: 867 Bytes

Contents

Spree.Views.Tables.SelectableTable.SumReturnItemAmount = Backbone.View.extend({
  initialize: function(options) {
    this.listenTo(this.model, 'change', this.render);

    this.render();
  },

  render: function() {
    var html = HandlebarsTemplates['tables/return_item_sum_amount']({
      total_pre_tax_refund: Spree.t("total_pre_tax_refund"),
      total_selected_item_amount: this.totalSelectedReturnItemAmount()
    });

    this.$el.html(html);
  },

  totalSelectedReturnItemAmount: function () {
    var totalAmount = 0.00;
    var selectedItems = [];

    if(this.model.get('allSelected')) {
      selectedItems = $('.selectable');
    } else {
      selectedItems = $(this.model.attributes.selectedItems);
    }
    selectedItems.each(function(_, selectedItem){
      totalAmount += $(selectedItem).data('price');
    })

    return totalAmount;
  },
});

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solidus_backend-2.11.4 app/assets/javascripts/spree/backend/views/tables/selectable_table/sum_return_item_amount.js
solidus_backend-2.11.3 app/assets/javascripts/spree/backend/views/tables/selectable_table/sum_return_item_amount.js
solidus_backend-2.11.2 app/assets/javascripts/spree/backend/views/tables/selectable_table/sum_return_item_amount.js
solidus_backend-2.11.1 app/assets/javascripts/spree/backend/views/tables/selectable_table/sum_return_item_amount.js
solidus_backend-2.11.0 app/assets/javascripts/spree/backend/views/tables/selectable_table/sum_return_item_amount.js