Sha256: 0956702ae3f199185048599b1b1767ae564bf8b1427a4a44dff72e4b54d703dc
Contents?: true
Size: 1.7 KB
Versions: 3
Compression:
Stored size: 1.7 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}); }); return selected; }; } );
Version data entries
3 entries across 3 versions & 1 rubygems