2017-12-12 13:15:26 -06:00
|
|
|
import coreModule from 'app/core/core_module';
|
2019-07-18 01:03:04 -05:00
|
|
|
import { BackendSrv } from 'app/core/services/backend_srv';
|
|
|
|
import { NavModelSrv } from 'app/core/core';
|
|
|
|
import { ILocationService } from 'angular';
|
2015-07-16 05:38:49 -05:00
|
|
|
|
2017-11-23 10:04:50 -06:00
|
|
|
export class UserInviteCtrl {
|
2017-12-13 06:16:44 -06:00
|
|
|
navModel: any;
|
|
|
|
invite: any;
|
|
|
|
inviteForm: any;
|
2015-07-16 05:38:49 -05:00
|
|
|
|
2018-08-31 09:40:43 -05:00
|
|
|
/** @ngInject */
|
2019-07-18 01:03:04 -05:00
|
|
|
constructor(private backendSrv: BackendSrv, navModelSrv: NavModelSrv, private $location: ILocationService) {
|
2017-12-13 06:16:44 -06:00
|
|
|
this.navModel = navModelSrv.getNav('cfg', 'users', 0);
|
|
|
|
|
|
|
|
this.invite = {
|
|
|
|
name: '',
|
|
|
|
email: '',
|
|
|
|
role: 'Editor',
|
|
|
|
sendEmail: true,
|
2017-12-12 13:15:26 -06:00
|
|
|
};
|
2017-12-13 06:16:44 -06:00
|
|
|
}
|
2017-12-12 13:15:26 -06:00
|
|
|
|
2017-12-13 06:16:44 -06:00
|
|
|
sendInvite() {
|
|
|
|
if (!this.inviteForm.$valid) {
|
|
|
|
return;
|
|
|
|
}
|
2015-07-17 02:51:34 -05:00
|
|
|
|
2017-12-13 06:16:44 -06:00
|
|
|
return this.backendSrv.post('/api/org/invites', this.invite).then(() => {
|
|
|
|
this.$location.path('org/users/');
|
|
|
|
});
|
2017-11-23 10:04:50 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-12 13:15:26 -06:00
|
|
|
coreModule.controller('UserInviteCtrl', UserInviteCtrl);
|