Check in a basic invoice view for organizations

This commit is contained in:
Joseph Schorr 2013-11-13 17:47:45 -05:00
parent b8dc051705
commit e649e669e1
4 changed files with 154 additions and 0 deletions

View file

@ -1187,6 +1187,10 @@ function OrgAdminCtrl($rootScope, $scope, Restangular, $routeParams, UserService
// Load the list of plans.
PlanService.getPlans(function(plans) {
$scope.plans = plans.business;
$scope.plan_map = {};
for (var i = 0; i < plans.business.length; ++i) {
$scope.plan_map[plans.business[i].stripeId] = plans.business[i];
}
});
var orgname = $routeParams.orgname;
@ -1194,6 +1198,23 @@ function OrgAdminCtrl($rootScope, $scope, Restangular, $routeParams, UserService
$scope.orgname = orgname;
$scope.membersLoading = true;
$scope.membersFound = null;
$scope.invoiceLoading = true;
$scope.loadInvoices = function() {
if ($scope.invoices) { return; }
$scope.invoiceLoading = true;
var getInvoices = Restangular.one(getRestUrl('organization', orgname, 'invoices'));
getInvoices.get().then(function(resp) {
$scope.invoiceExpanded = {};
$scope.invoices = resp.invoices;
$scope.invoiceLoading = false;
});
};
$scope.toggleInvoice = function(id) {
$scope.invoiceExpanded[id] = !$scope.invoiceExpanded[id];
};
$scope.loadMembers = function() {
if ($scope.membersFound) { return; }