mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-01 23:01:28 +01:00
billing seat adjustments
This commit is contained in:
parent
f8fcbbea85
commit
24cbe13ca7
@ -0,0 +1,36 @@
|
|||||||
|
angular
|
||||||
|
.module('bit.organization')
|
||||||
|
|
||||||
|
.controller('organizationBillingAdjustSeatsController', function ($scope, $state, $uibModalInstance, apiService,
|
||||||
|
$analytics, toastr, add) {
|
||||||
|
$scope.add = add;
|
||||||
|
$scope.seatAdjustment = 0;
|
||||||
|
|
||||||
|
$scope.submit = function () {
|
||||||
|
var request = {
|
||||||
|
seatAdjustment: $scope.seatAdjustment
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!add) {
|
||||||
|
request.seatAdjustment *= -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.submitPromise = apiService.organizations.putSeat({ id: $state.params.orgId }, request)
|
||||||
|
.$promise.then(function (response) {
|
||||||
|
if (add) {
|
||||||
|
$analytics.eventTrack('Added Seats');
|
||||||
|
toastr.success('You have added ' + $scope.seatAdjustment + ' seats.');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$analytics.eventTrack('Removed Seats');
|
||||||
|
toastr.success('You have removed ' + $scope.seatAdjustment + ' seats.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$uibModalInstance.close();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.close = function () {
|
||||||
|
$uibModalInstance.dismiss('cancel');
|
||||||
|
};
|
||||||
|
});
|
@ -29,6 +29,23 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.adjustSeats = function (add) {
|
||||||
|
var modal = $uibModal.open({
|
||||||
|
animation: true,
|
||||||
|
templateUrl: 'app/organization/views/organizationBillingAdjustSeats.html',
|
||||||
|
controller: 'organizationBillingAdjustSeatsController',
|
||||||
|
resolve: {
|
||||||
|
add: function () {
|
||||||
|
return add;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
modal.result.then(function () {
|
||||||
|
load();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.cancel = function () {
|
$scope.cancel = function () {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -72,10 +72,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-footer" ng-if="!noSubscription">
|
<div class="box-footer" ng-if="!noSubscription">
|
||||||
<button type="button" class="btn btn-default btn-flat" ng-click="addSeats()">
|
<button type="button" class="btn btn-default btn-flat" ng-click="adjustSeats(true)">
|
||||||
Add Seats
|
Add Seats
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-default btn-flat" ng-click="removeSeats()">
|
<button type="button" class="btn btn-default btn-flat" ng-click="adjustSeats(false)">
|
||||||
Remove Seats
|
Remove Seats
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||||
|
<h4 class="modal-title">
|
||||||
|
<i class="fa fa-users"></i>
|
||||||
|
{{add ? 'Add Seats' : 'Remove Seats'}}
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<form name="form" ng-submit="form.$valid && submit()" api-form="submitPromise">
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="callout callout-danger validation-errors" ng-show="form.$errors">
|
||||||
|
<h4>Errors have occured</h4>
|
||||||
|
<ul>
|
||||||
|
<li ng-repeat="e in form.$errors">{{e}}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="seats">{{add ? 'Seats To Add' : 'Seats To Remove'}}</label>
|
||||||
|
<input type="number" id="seats" name="SeatAdjustment" ng-model="seatAdjustment" class="form-control"
|
||||||
|
required min="0" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="form.$loading">
|
||||||
|
<i class="fa fa-refresh fa-spin loading-icon" ng-show="form.$loading"></i>Submit
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
@ -40,6 +40,9 @@
|
|||||||
post: { method: 'POST', params: {} },
|
post: { method: 'POST', params: {} },
|
||||||
put: { method: 'POST', params: { id: '@id' } },
|
put: { method: 'POST', params: { id: '@id' } },
|
||||||
putPayment: { url: _apiUri + '/organizations/:id/payment', method: 'POST', params: { id: '@id' } },
|
putPayment: { url: _apiUri + '/organizations/:id/payment', method: 'POST', params: { id: '@id' } },
|
||||||
|
putSeat: { url: _apiUri + '/organizations/:id/seat', method: 'POST', params: { id: '@id' } },
|
||||||
|
putUpgrade: { url: _apiUri + '/organizations/:id/upgrade', method: 'POST', params: { id: '@id' } },
|
||||||
|
putCancel: { url: _apiUri + '/organizations/:id/cancel', method: 'POST', params: { id: '@id' } },
|
||||||
del: { url: _apiUri + '/organizations/:id/delete', method: 'POST', params: { id: '@id' } }
|
del: { url: _apiUri + '/organizations/:id/delete', method: 'POST', params: { id: '@id' } }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -139,6 +139,7 @@
|
|||||||
<script src="app/organization/organizationSettingsController.js"></script>
|
<script src="app/organization/organizationSettingsController.js"></script>
|
||||||
<script src="app/organization/organizationBillingController.js"></script>
|
<script src="app/organization/organizationBillingController.js"></script>
|
||||||
<script src="app/organization/organizationBillingChangePaymentController.js"></script>
|
<script src="app/organization/organizationBillingChangePaymentController.js"></script>
|
||||||
|
<script src="app/organization/organizationBillingAdjustSeatsController.js"></script>
|
||||||
|
|
||||||
<script src="app/settings/settingsModule.js"></script>
|
<script src="app/settings/settingsModule.js"></script>
|
||||||
<script src="app/settings/settingsController.js"></script>
|
<script src="app/settings/settingsController.js"></script>
|
||||||
|
Loading…
Reference in New Issue
Block a user