|
|
@ -42,6 +42,8 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
|
|
|
|
app.controller('bdPrizeRootCtrl', ['$scope', '$http', '$uibModal', 'commonDialog', function ($scope, $http, $uibModal, commonDialog) {
|
|
|
|
app.controller('bdPrizeRootCtrl', ['$scope', '$http', '$uibModal', 'commonDialog', function ($scope, $http, $uibModal, commonDialog) {
|
|
|
|
$scope.params = {year: new Date().getFullYear()};
|
|
|
|
$scope.params = {year: new Date().getFullYear()};
|
|
|
|
$scope.availableYears = [new Date().getFullYear() - 1, new Date().getFullYear()];
|
|
|
|
$scope.availableYears = [new Date().getFullYear() - 1, new Date().getFullYear()];
|
|
|
|
|
|
|
|
$scope.kpiRanges = [{value: 1, label: '0-0.5'}, {value: 2, label: '0.5-0.8'}, {value: 3, label: '0.8-1'},
|
|
|
|
|
|
|
|
{value: 4, label: '1-1.2'}, {value: 5, label: '>=1.2'}];
|
|
|
|
$scope.initMonth = function (year) {
|
|
|
|
$scope.initMonth = function (year) {
|
|
|
|
$scope.params.year = year;
|
|
|
|
$scope.params.year = year;
|
|
|
|
$scope.months = [];
|
|
|
|
$scope.months = [];
|
|
|
@ -87,12 +89,12 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
|
|
|
|
$scope.loadRateConfigs = function () {
|
|
|
|
$scope.loadRateConfigs = function () {
|
|
|
|
$http.get('/sys/bd_prize/config/rates').then(function (resp) {
|
|
|
|
$http.get('/sys/bd_prize/config/rates').then(function (resp) {
|
|
|
|
$scope.bd_rate_configs = resp.data;
|
|
|
|
$scope.bd_rate_configs = resp.data;
|
|
|
|
$scope.bd_rate_ranges = [];
|
|
|
|
$scope.kpi_ranges = [];
|
|
|
|
var rangeStart = [];
|
|
|
|
var kpiStart = [];
|
|
|
|
angular.forEach($scope.bd_rate_configs, function (cfg) {
|
|
|
|
angular.forEach($scope.bd_rate_configs, function (cfg) {
|
|
|
|
if (rangeStart.indexOf(cfg.rate_from) < 0) {
|
|
|
|
if (kpiStart.indexOf(cfg.kpi_range) < 0) {
|
|
|
|
rangeStart.push(cfg.rate_from);
|
|
|
|
kpiStart.push(cfg.kpi_range);
|
|
|
|
$scope.bd_rate_ranges.push(cfg);
|
|
|
|
$scope.kpi_ranges.push(cfg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -137,9 +139,10 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
|
|
|
|
value: 3,
|
|
|
|
value: 3,
|
|
|
|
label: '>=7 Months'
|
|
|
|
label: '>=7 Months'
|
|
|
|
}];
|
|
|
|
}];
|
|
|
|
$scope.kpiRanges = [{value: 1, label: '<50%'}, {value: 2, label: '50%<=kpi<80%'}, {value: 3, label: '80%<=kpi<100%'},
|
|
|
|
$scope.kpiRanges = [{value: 1, label: '0-0.5'}, {value: 2, label: '0.5-0.8'}, {value: 3, label: '0.8-1'},
|
|
|
|
{value: 4, label: '100%<=kpi<120%'}, {value: 5, label: '>=120%'}];
|
|
|
|
{value: 4, label: '1-1.2'}, {value: 5, label: '>=1.2'}];
|
|
|
|
$scope.filter = {bd_level: 1, months: 1,kpi_range:1};
|
|
|
|
$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.rates = rates;
|
|
|
|
$scope.submitRates = function () {
|
|
|
|
$scope.submitRates = function () {
|
|
|
|
var validation = null;
|
|
|
|
var validation = null;
|
|
|
@ -194,7 +197,7 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
|
|
|
|
app.controller('bdCommissionConfigCtrl', ['$scope', '$state', '$http', '$filter', 'monModal', function ($scope, $state, $http, $filter, monModal) {
|
|
|
|
app.controller('bdCommissionConfigCtrl', ['$scope', '$state', '$http', '$filter', 'monModal', function ($scope, $state, $http, $filter, monModal) {
|
|
|
|
$scope.monModal = monModal;
|
|
|
|
$scope.monModal = monModal;
|
|
|
|
$scope.params = {year: new Date().getFullYear()};
|
|
|
|
$scope.params = {year: new Date().getFullYear()};
|
|
|
|
$scope.bdtypes = [{id: 1, label: 'Director'}, {id: 2, label: 'Manager'}, {id: 3, label: 'Sydney GM'},{id: 4, label: 'COO'},{id: 5, label: 'NJ Department'}];
|
|
|
|
$scope.bdtypes = [{id: 1, label: 'BD Manager'}, {id: 2, label: 'KA Manager'}, {id: 3, label: 'Sydney GM'},{id: 4, label: 'COO'},{id: 5, label: 'NJ Department'}];
|
|
|
|
// $scope.bdmon;
|
|
|
|
// $scope.bdmon;
|
|
|
|
// $scope.newSwitch;
|
|
|
|
// $scope.newSwitch;
|
|
|
|
$scope.initMonth = function (year) {
|
|
|
|
$scope.initMonth = function (year) {
|
|
|
@ -218,6 +221,28 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
};
|
|
|
|
};
|
|
|
|
$scope.getBDLevels();
|
|
|
|
$scope.getBDLevels();
|
|
|
|
|
|
|
|
$scope.chooseLastConfig = function (mon) {
|
|
|
|
|
|
|
|
var index = $scope.months.indexOf(mon);
|
|
|
|
|
|
|
|
if(index == 0){
|
|
|
|
|
|
|
|
var year = new Date().getFullYear();
|
|
|
|
|
|
|
|
year--;
|
|
|
|
|
|
|
|
mon = year + '-12';
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
mon = $scope.months[index-1];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$http.get('/sys/bd_prize/commission/le_ma/' + mon).then(function (resp) {
|
|
|
|
|
|
|
|
$scope.bdlm = [];
|
|
|
|
|
|
|
|
angular.forEach(resp.data,function (e) {
|
|
|
|
|
|
|
|
var bdC = {};
|
|
|
|
|
|
|
|
bdC.commission_start_amount = e.commission_start_amount;
|
|
|
|
|
|
|
|
bdC.commission_end_amount = e.commission_end_amount;
|
|
|
|
|
|
|
|
bdC.bd_commission_rate = e.bd_commission_rate;
|
|
|
|
|
|
|
|
bdC.bd_type = e.bd_type;
|
|
|
|
|
|
|
|
$scope.bdlm.push(bdC);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$scope.listConfig = true;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
};
|
|
|
|
$scope.listCurrentMonBDCommission = function (mon) {
|
|
|
|
$scope.listCurrentMonBDCommission = function (mon) {
|
|
|
|
$http.get('/sys/bd_prize/commission/le_ma/' + mon).then(function (resp) {
|
|
|
|
$http.get('/sys/bd_prize/commission/le_ma/' + mon).then(function (resp) {
|
|
|
|
$scope.bdlm = resp.data;
|
|
|
|
$scope.bdlm = resp.data;
|
|
|
@ -277,13 +302,15 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$scope.submitBdCommmissionConfig = function (mon, bds) {
|
|
|
|
$scope.submitBdCommmissionConfig = function (mon, bds) {
|
|
|
|
$scope.check = true;
|
|
|
|
$scope.check = true;
|
|
|
|
angular.forEach(bds, function (data, index) {
|
|
|
|
|
|
|
|
$scope.errmsg = null;
|
|
|
|
$scope.errmsg = null;
|
|
|
|
|
|
|
|
angular.forEach(bds, function (data, index) {
|
|
|
|
|
|
|
|
if(data.get_prize){
|
|
|
|
if (!data.kpi_amount) {
|
|
|
|
if (!data.kpi_amount) {
|
|
|
|
$scope.errmsg = "BD kpi Amount not be null";
|
|
|
|
$scope.errmsg = "BD kpi Amount not be null";
|
|
|
|
$scope.check = false;
|
|
|
|
$scope.check = false;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if ($scope.check) {
|
|
|
|
if ($scope.check) {
|
|
|
|
$http.post('/sys/bd_prize/commission/kpi/update/' + mon, bds).then(function (resp) {
|
|
|
|
$http.post('/sys/bd_prize/commission/kpi/update/' + mon, bds).then(function (resp) {
|
|
|
|