Sha256: 4aed1b4ca91a7bc64e557ba67580786eb638947f8c608fe5af601e6b8d12a483
Contents?: true
Size: 1.74 KB
Versions: 13
Compression:
Stored size: 1.74 KB
Contents
/** * @ngdoc service * @name Bastion.subscriptions.service:SubscriptionsHelper * * @description * Helper service that contains functionality common amongst subscriptions. */ angular.module('Bastion.subscriptions').service('SubscriptionsHelper', function () { this.groupByProductName = function (rows) { var grouped, offset, subscription; grouped = {}; for (offset = 0; offset < rows.length; offset += 1) { subscription = rows[offset]; if (angular.isUndefined(grouped[subscription.name])) { grouped[subscription.name] = []; } grouped[subscription.name].push(subscription); } return grouped; }; this.getSelectedSubscriptionAmounts = function (table) { var selected, amount; selected = []; angular.forEach(table.getSelected(), function (subscription) { if (subscription['multi_entitlement']) { amount = subscription.amount; if (!amount) { amount = 0; } } else { amount = 1; } selected.push({"id": subscription.id, "quantity": amount}); }); return selected; }; this.getSelectedSubscriptions = function (table) { var selected; selected = []; angular.forEach(table.getSelected(), function (subscription) { selected.push({"id": subscription.id, "quantity": subscription.quantity_consumed}); }); return selected; }; } );
Version data entries
13 entries across 13 versions & 1 rubygems