Sha256: 098e42631f44b5aa84340c8cda97f8601423c6496edcf51c2d52d4ecf817fe01
Contents?: true
Size: 1.18 KB
Versions: 80
Compression:
Stored size: 1.18 KB
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; var selectedItems = []; var decimals = 0; var separator = Spree.t('currency_separator'); var amount, decimalAmount; if(this.model.get('allSelected')) { selectedItems = $('.selectable'); } else { selectedItems = $(this.model.attributes.selectedItems); } selectedItems.each(function(_, selectedItem){ amount = $(selectedItem).data('price'); decimalAmount = amount.toString().split(separator)[1] || ''; decimals = Math.max(decimals, decimalAmount.length); totalAmount += parseFloat(amount); }) return accounting.formatNumber(totalAmount, decimals, Spree.t('currency_delimiter'), separator); }, });
Version data entries
80 entries across 80 versions & 1 rubygems