feat(maker): admin oper can create maker group for user now, in user manager page

This commit is contained in:
OldHawk
2017-10-19 18:44:22 +08:00
parent 7eb4a45522
commit 18f3af75cb
25 changed files with 541 additions and 35 deletions

View File

@@ -6,10 +6,10 @@
.controller('UserController', UserController);
UserController.$inject = ['$scope', '$state', '$window', 'Authentication', 'userResolve', 'Notification', 'NotifycationService', 'MeanTorrentConfig',
'AdminService', 'ScoreLevelService', 'DebugConsoleService', 'TorrentGetInfoServices'];
'AdminService', 'ScoreLevelService', 'DebugConsoleService', 'TorrentGetInfoServices', 'SideOverlay', 'MakerGroupService'];
function UserController($scope, $state, $window, Authentication, user, Notification, NotifycationService, MeanTorrentConfig,
AdminService, ScoreLevelService, mtDebug, TorrentGetInfoServices) {
AdminService, ScoreLevelService, mtDebug, TorrentGetInfoServices, SideOverlay, MakerGroupService) {
var vm = this;
vm.TGI = TorrentGetInfoServices;
vm.authentication = Authentication;
@@ -26,6 +26,7 @@
vm.scoreLevelData = ScoreLevelService.getScoreLevelJson(vm.user.score);
vm.searchTags = [];
vm.maker = {};
vm.setUserScorePopover = {
title: 'SCORE_TITLE',
@@ -45,6 +46,7 @@
isOpen: false
};
mtDebug.info(vm.user);
/**
* remove
* @param user
@@ -151,6 +153,51 @@
}
};
/**
* showMakerGroup
* @param evt
*/
vm.showMakerGroup = function (evt) {
vm.maker = {};
SideOverlay.open(evt, 'makerSlide');
};
/**
* hideTagsPopup
*/
vm.hideMakerPopup = function () {
SideOverlay.close(null, 'makerSlide');
};
/**
* createMakerGroup
*/
vm.createMakerGroup = function () {
vm.maker.userId = vm.user._id;
var maker = new MakerGroupService(vm.maker);
mtDebug.info(maker);
maker.$save(function (response) {
successCallback(response);
}, function (errorResponse) {
errorCallback(errorResponse);
});
function successCallback(res) {
vm.maker = {};
vm.user = res;
NotifycationService.showSuccessNotify('ABOUT.MAKER_CREATE_SUCCESSFULLY');
SideOverlay.close(null, 'makerSlide');
}
function errorCallback(res) {
vm.maker = {};
NotifycationService.showErrorNotify(res.data.message, 'ABOUT.MAKER_CREATE_FAILED');
}
};
/**
* onUserRoleChanged
* admin set user`s role