diff --git a/src/main/ui/static/config/managers/templates/new_manager.html b/src/main/ui/static/config/managers/templates/new_manager.html index 3c17c0c5a..96a455d20 100644 --- a/src/main/ui/static/config/managers/templates/new_manager.html +++ b/src/main/ui/static/config/managers/templates/new_manager.html @@ -51,7 +51,7 @@ -
diff --git a/src/main/ui/static/config/organizations/organizations.js b/src/main/ui/static/config/organizations/organizations.js index ee9c14165..175906192 100644 --- a/src/main/ui/static/config/organizations/organizations.js +++ b/src/main/ui/static/config/organizations/organizations.js @@ -26,6 +26,15 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { return $http.get('/sys/orgs/' + $stateParams.orgId); }] } + }).state('organizations.detail_parent', { + url: '/{orgId}/detail_parent', + templateUrl: '/static/config/organizations/templates/org_detail_parent.html', + controller: 'orgDetailParentCtrl', + resolve: { + org: ['$http', '$stateParams', function ($http, $stateParams) { + return $http.get('/sys/orgs/' + $stateParams.orgId); + }] + } }).state('organizations.new', { url: '/new_org', templateUrl: '/static/config/organizations/templates/new_org.html', @@ -166,6 +175,103 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { }) } }]); + app.controller('orgDetailParentCtrl', ['$scope', '$http', '$state', 'Upload', '$uibModal','commonDialog', 'org', function ($scope, $http, $state, Upload,$uibModal,commonDialog, org) { + $scope.types = angular.copy(types); + $scope.org = angular.copy(org.data); + if ($scope.currentUser.org_id != null) { + $scope.org.type = 0; + } + $scope.uploadLogo = function (file) { + if (file == null) { + return; + } + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.org.logo = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + }; + $scope.update = function (form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true; + } + }); + return; + } + $http.put('/sys/orgs/' + $scope.org.org_id, $scope.org).then(function () { + commonDialog.alert({title: 'Succeed', content: 'Organization update succeeded', type: 'success'}); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + }) + }; +/* + $scope.toggleRateEditable = function () { + if($scope.org.rate_editable==org.data.rate_editable){ + return; + } + $http.put('/sys/orgs/'+$scope.org.org_id+'/enable_change_rate',{enabled:$scope.org.rate_editable}).then(function () { + + },function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }; + + $scope.search = {role:'1111111'}; + $scope.listManagers = function () { + $http.get('/sys/manager_accounts',{params:{org_id:$scope.org.org_id}}).then(function (resp) { + $scope.managers = resp.data; + }) + }; + + $scope.listManagers(); + $scope.modifyManager = function (manager) { + $uibModal.open({ + templateUrl: '/static/config/managers/templates/modify.html', + controller: 'modifyManagerCtrl', + resolve: { + manager: function () { + return angular.copy(manager); + } + } + }).result.then(function () { + $scope.listManagers(); + }) + }; + $scope.disableManager = function (manager) { + commonDialog.confirm({ + title: 'Confirm!', + content: 'You are setting manager ' + manager.display_name + ' disabled.Are you sure?' + }).then(function () { + $http.delete('/sys/manager_accounts/' + manager.manager_id).then(function () { + $scope.listManagers(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + }) + }) + }; + $scope.newManager = function () { + $uibModal.open({ + templateUrl: '/static/config/managers/templates/new_manager.html', + controller: 'newManagerCtrl', + resolve: { + org: angular.copy($scope.org) + } + }).result.then(function () { + $scope.listManagers(); + }) + }*/ + }]); app.controller('newOrgCtrl', ['$scope', '$http', '$state', 'Upload', 'commonDialog', function ($scope, $http, $state, Upload, commonDialog) { $scope.types = angular.copy(types); $scope.uploadLogo = function (file) { @@ -242,6 +348,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { }); return; } + if(currentUser.org_id != null && !currentUser.parent_org_id){ + $scope.manager.bd=true; + } + $http.post('/sys/manager_accounts', $scope.manager).then(function () { $scope.$close(); }, function (resp) { diff --git a/src/main/ui/static/config/organizations/templates/org_detail_parent.html b/src/main/ui/static/config/organizations/templates/org_detail_parent.html new file mode 100644 index 000000000..e2053af76 --- /dev/null +++ b/src/main/ui/static/config/organizations/templates/org_detail_parent.html @@ -0,0 +1,255 @@ + + + + + Basic Config + + Organizations + + + + + + + + + + + + + Name * + + + + + + Logo + + + + Upload + + + + + + + + Location * + + + + + + Type * + + + + + + + + + + + + + Rate * + + + % + + + + + + Alipay Rate * + + + % + + + + + Wechat Rate * + + + % + + + + + Bestpay Rate * + + + % + + + + + JD Pay Rate * + + + % + + + + + AlipayOnline Rate * + + + % + + + + + + Contact Person * + + + + + + Phone * + + + + + + Mail * + + + + + + Enable Commission + + + + + + Remark + + + + + + + Save + + Back + + + + + + + + + + \ No newline at end of file diff --git a/src/main/ui/static/config/organizations/templates/orgs.html b/src/main/ui/static/config/organizations/templates/orgs.html index d71f939a3..5ed4c54e7 100644 --- a/src/main/ui/static/config/organizations/templates/orgs.html +++ b/src/main/ui/static/config/organizations/templates/orgs.html @@ -161,11 +161,15 @@ Edit - | + ui-sref=".detail({orgId:org.org_id})" ng-if="(currentUser.org_id == null) || (org.parent_org_id == currentUser.org_id)"> Edit | + + Disable + ng-click="disableOrg(org)" ng-if="(currentUser.org_id == null)||(org.parent_org_id == currentUser.org_id)">Disable + + Detail
+ + Upload + + + +