|
|
@ -9,12 +9,106 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}]);
|
|
|
|
}]);
|
|
|
|
app.controller('listMenuCtrl', ['$scope', '$http', '$filter','$uibModal', 'commonDialog','$stateParams', function ($scope, $http,$filter, $uibModal, commonDialog,$stateParams) {
|
|
|
|
app.controller('listMenuCtrl', ['$scope', '$http', '$filter','$uibModal', 'commonDialog','$stateParams', function ($scope, $http,$filter, $uibModal, commonDialog,$stateParams) {
|
|
|
|
|
|
|
|
$scope.display = function () {
|
|
|
|
|
|
|
|
var json = {};
|
|
|
|
|
|
|
|
$(".list-group").each(function () {
|
|
|
|
|
|
|
|
var child = ($(".list-group").find('a')).length;
|
|
|
|
|
|
|
|
var label = ($(".list-group").find("label:first-child")).val();
|
|
|
|
|
|
|
|
if (child >0) {
|
|
|
|
|
|
|
|
json[label] = true;
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
json[label] = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return json;
|
|
|
|
|
|
|
|
};
|
|
|
|
function init() {
|
|
|
|
function init() {
|
|
|
|
console.log("dadadadada + " + $stateParams.role);
|
|
|
|
console.log("dadadadada + " + $stateParams.role);
|
|
|
|
|
|
|
|
/*console.log("json + " + $scope.display());*/
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.editRateConfig = function () {
|
|
|
|
|
|
|
|
$uibModal.open({
|
|
|
|
|
|
|
|
templateUrl: '/static/config/bdprize/templates/rate_config_dialog.html',
|
|
|
|
|
|
|
|
controller: 'bdRateConfigCtrl',
|
|
|
|
|
|
|
|
resolve: {
|
|
|
|
|
|
|
|
rates: function () {
|
|
|
|
|
|
|
|
return angular.copy($scope.bd_rate_configs);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}).result.then(function () {
|
|
|
|
|
|
|
|
$scope.loadRateConfigs();
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.editBDLevels = function () {
|
|
|
|
|
|
|
|
$uibModal.open({
|
|
|
|
|
|
|
|
templateUrl: '/static/config/bdprize/templates/bd_level_config_dialog.html',
|
|
|
|
|
|
|
|
controller: 'bdLevelConfigCtrl'
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
init();
|
|
|
|
init();
|
|
|
|
|
|
|
|
|
|
|
|
}]);
|
|
|
|
}]);
|
|
|
|
|
|
|
|
app.controller('bdRateConfigCtrl', ['$scope', '$http', 'rates', function ($scope, $http, rates) {
|
|
|
|
|
|
|
|
$scope.bdLevels = [{value: 1, label: 'Junior'}, {value: 2, label: 'Intermediate'}, {value: 3, label: 'Senior'}];
|
|
|
|
|
|
|
|
$scope.months = [{value: 1, label: '1-3 Months'}, {value: 2, label: '4-6 Months'}, {
|
|
|
|
|
|
|
|
value: 3,
|
|
|
|
|
|
|
|
label: '>=7 Months'
|
|
|
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
$scope.kpiRanges = [{value: 1, label: '0-50%'}, {value: 2, label: '50%~80%'}, {value: 3, label: '80%~100%'},
|
|
|
|
|
|
|
|
{value: 4, label: '100%-120%'}, {value: 5, label: '>=120%'}];
|
|
|
|
|
|
|
|
$scope.clientRate = [{value: 0.6, label: '0.6-0.79'}, {value: 0.8, label: '0.8-2.0'}];
|
|
|
|
|
|
|
|
$scope.filter = {bd_level: 1,rate_from:0.6};
|
|
|
|
|
|
|
|
$scope.rates = rates;
|
|
|
|
|
|
|
|
$scope.submitRates = function () {
|
|
|
|
|
|
|
|
var validation = null;
|
|
|
|
|
|
|
|
$scope.errmsg = null;
|
|
|
|
|
|
|
|
angular.forEach($scope.rates, function (rate) {
|
|
|
|
|
|
|
|
if (isNaN(rate.prize_rate)) {
|
|
|
|
|
|
|
|
validation = {months: rate.time_range, bd_level: rate.bd_level};
|
|
|
|
|
|
|
|
$scope.errmsg = 'Rate Value is NaN';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rate.prize_rate > 1) {
|
|
|
|
|
|
|
|
validation = {months: rate.time_range, bd_level: rate.bd_level};
|
|
|
|
|
|
|
|
$scope.errmsg = 'Rate value shall no more than 1%';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rate.prize_rate < 0) {
|
|
|
|
|
|
|
|
validation = {months: rate.time_range, bd_level: rate.bd_level};
|
|
|
|
|
|
|
|
$scope.errmsg = 'Rate value shall be a positive value';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!validation) {
|
|
|
|
|
|
|
|
$http.put('/sys/bd_prize/config/rates', $scope.rates).then(function () {
|
|
|
|
|
|
|
|
$scope.$close();
|
|
|
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
|
|
|
$scope.errmsg = resp.data.message;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
app.controller('bdLevelConfigCtrl', ['$scope', '$http', function ($scope, $http) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.getBDGroups = function () {
|
|
|
|
|
|
|
|
$http.get('/sys/manager_accounts/roles/bd_leader').then(function (resp) {
|
|
|
|
|
|
|
|
$scope.bdgroups = resp.data;
|
|
|
|
|
|
|
|
$scope.getBDLevels();
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.getBDGroups();
|
|
|
|
|
|
|
|
$scope.getBDLevels = function () {
|
|
|
|
|
|
|
|
$http.get('/sys/bd_prize/config/bd_levels').then(function (resp) {
|
|
|
|
|
|
|
|
$scope.bds = resp.data;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.bdLevels = [{value: 1, label: 'Junior'}, {value: 2, label: 'Intermediate'}, {value: 3, label: 'Senior'}];
|
|
|
|
|
|
|
|
$scope.updateBDLevel = function (bdInfo) {
|
|
|
|
|
|
|
|
$http.put('/sys/bd_prize/config/bd_levels/' + bdInfo.manager_id, bdInfo).then(function () {
|
|
|
|
|
|
|
|
$scope.getBDGroups();
|
|
|
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
|
|
|
$scope.errmsg = resp.data.message;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}]);
|
|
|
|
return app;
|
|
|
|
return app;
|
|
|
|
});
|
|
|
|
});
|
|
|
|