master
yuan 7 years ago
parent d8041ca3ce
commit c10502580f

@ -51,7 +51,7 @@
<input class="form-control" type="text" id="wechat-input" name="wechat" <input class="form-control" type="text" id="wechat-input" name="wechat"
ng-model="manager.wechat"> ng-model="manager.wechat">
</div> </div>
<div class="form-group"> <div class="form-group" ng-if="!currentUser.org_id">
<label class="control-label">Roles</label> <label class="control-label">Roles</label>
<p class="checkbox checkbox-inline"> <p class="checkbox checkbox-inline">
<label ng-if="('00001'|withRole)"> <label ng-if="('00001'|withRole)">

@ -26,6 +26,15 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
return $http.get('/sys/orgs/' + $stateParams.orgId); 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', { }).state('organizations.new', {
url: '/new_org', url: '/new_org',
templateUrl: '/static/config/organizations/templates/new_org.html', 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) { app.controller('newOrgCtrl', ['$scope', '$http', '$state', 'Upload', 'commonDialog', function ($scope, $http, $state, Upload, commonDialog) {
$scope.types = angular.copy(types); $scope.types = angular.copy(types);
$scope.uploadLogo = function (file) { $scope.uploadLogo = function (file) {
@ -242,6 +348,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}); });
return; return;
} }
if(currentUser.org_id != null && !currentUser.parent_org_id){
$scope.manager.bd=true;
}
$http.post('/sys/manager_accounts', $scope.manager).then(function () { $http.post('/sys/manager_accounts', $scope.manager).then(function () {
$scope.$close(); $scope.$close();
}, function (resp) { }, function (resp) {

@ -0,0 +1,255 @@
<style>
.form-control-float {
float: left;
width: 93%; !important;
}
.form-control-span{
height: 34px;
}
</style>
<section class="content-header">
<h1 ng-bind="org.name"></h1>
<ol class="breadcrumb">
<li><i class="fa fa-users"></i> Basic Config</li>
<li>
<a ui-sref="^" ui-sref-opts="{reload:true}">Organizations</a>
</li>
<li class="active" ng-bind="org.name"></li>
</ol>
</section>
<section class="content">
<div class="box box-warning">
<div class="box-body">
<uib-tabset>
<uib-tab heading="Basic Info">
<form class="form-horizontal margin-top" name="org_form" novalidate>
<div class="panel">
<div class="form-group" ng-class="{'has-error':org_form.name.$invalid && org_form.name.$dirty}">
<label class="control-label col-sm-2" for="org_name_input">Name *</label>
<div class="col-sm-8">
<input class="form-control" ng-model="org.name" id="org_name_input" name="name" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Logo</label>
<div class="col-sm-8">
<p class="form-control-static">
<button class="btn btn-primary" type="button" ngf-select="uploadLogo($file)"
accept="image/*" ngf-max-size="1MB">
<i class="fa fa-upload"></i> Upload
</button>
<uib-progressbar value="logoProgress.value" ng-if="logoProgress"></uib-progressbar>
<img ng-src="{{org.logo}}" class="col-sm-3" ng-if="org.logo">
</p>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.location.$invalid && org_form.location.$dirty}">
<label class="control-label col-sm-2" for="org_location_input">Location *</label>
<div class="col-sm-8">
<input class="form-control" ng-model="org.location" id="org_location_input" name="location" required>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.type.$invalid && org_form.type.$dirty}"
ng-if="!currentUser.org_id">
<label class="control-label col-sm-2" for="org_type_input">Type *</label>
<div class="col-sm-8">
<!--<select class="form-control" ng-model="org.type" ng-init="org.type=0" id="org_type_input">-->
<!--<option value="0">代理人</option>-->
<!--<option value="1">推荐人</option>-->
<!--</select>-->
<select class="form-control" name="type" required ng-model="org.type"
id="org_type_input"
ng-options="type.value as type.label for type in types">
<!--<option value="">Please Choose</option>-->
</select>
</div>
</div>
<div ng-if="org.type == 1">
<div class="form-group" ng-class="{'has-error':org_form.rate_value.$invalid && org_form.rate_value.$dirty}">
<label class="control-label col-sm-2" for="rate_value_input">Rate *</label>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.rate_value" id="rate_value_input" name="rate_value" max="100">
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
</div>
<div ng-if="org.type == 0">
<div class="form-group" ng-class="{'has-error':org_form.alipay_rate_value.$invalid && org_form.alipay_rate_value.$dirty}">
<label class="control-label col-sm-2" for="alipay_rate_value_input">Alipay Rate *</label>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.alipay_rate_value" id="alipay_rate_value_input" name="alipay_rate_value" max="100" readonly>
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.wechat_rate_value.$invalid && org_form.wechat_rate_value.$dirty}">
<label class="control-label col-sm-2" for="wechat_rate_value_input">Wechat Rate *</label>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.wechat_rate_value" id="wechat_rate_value_input" name="wechat_rate_value" max="100" readonly>
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.bestpay_rate_value.$invalid && org_form.bestpay_rate_value.$dirty}">
<label class="control-label col-sm-2" for="bestpay_rate_value_input">Bestpay Rate *</label>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.bestpay_rate_value" id="bestpay_rate_value_input" name="bestpay_rate_value" max="100" readonly>
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.jd_rate_value.$invalid && org_form.jd_rate_value.$dirty}">
<label class="control-label col-sm-2" for="jd_rate_value_input">JD Pay Rate *</label>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.jd_rate_value" id="jd_rate_value_input" name="jd_rate_value" max="100" readonly>
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.alipayonline_rate_value.$invalid && org_form.alipayonline_rate_value.$dirty}">
<label class="control-label col-sm-2" for="alipayonline_rate_value_input">AlipayOnline Rate *</label>
<div class="col-sm-8">
<input class="form-control form-control-float" type="number" ng-model="org.alipayonline_rate_value" id="alipayonline_rate_value_input" name="alipayonline_rate_value" max="100" readonly>
<span class="input-group-addon form-control-span">%</span>
</div>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.contact_person.$invalid && org_form.contact_person.$dirty}">
<label class="control-label col-sm-2" for="org_contact_person_input">Contact Person *</label>
<div class="col-sm-8">
<input class="form-control" ng-model="org.contact_person" id="org_contact_person_input" name="contact_person" required>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.contact_phone.$invalid && org_form.contact_phone.$dirty}">
<label class="control-label col-sm-2" for="org_contact_phone_input">Phone *</label>
<div class="col-sm-8">
<input class="form-control" ng-model="org.contact_phone" id="org_contact_phone_input" name="contact_phone" required>
</div>
</div>
<div class="form-group" ng-class="{'has-error':org_form.contact_mail.$invalid && org_form.contact_mail.$dirty}">
<label class="control-label col-sm-2" for="org_contact_mail_input">Mail *</label>
<div class="col-sm-8">
<input class="form-control" ng-model="org.contact_mail" id="org_contact_mail_input" name="contact_mail" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="commission_checkbox">Enable Commission</label>
<div class="col-sm-8">
<input id="commission_checkbox" type="checkbox" class="checkbox-inline checkbox" ng-model="org.commission" readonly
onclick="return false">
</div>
</div>
<div class="form-group"
ng-class="{'has-error':org_form.remark.$invalid && org_form.remark.$dirty}">
<label class="control-label col-sm-2" for="remark-input">Remark</label>
<div class="col-sm-8">
<textarea class="form-control" ng-model="org.remark" name="remark"
id="remark-input" maxlength="500"></textarea>
</div>
</div>
</div>
<div class="btn-group margin-bottom margin-top">
<button class="btn btn-success" type="button" ng-click="update(org_form)">Save
</button>
<a class="btn btn-danger" role="button" ui-sref="^" ui-sref-opts="{reload:true}">Back</a>
</div>
<!--<button class="btn btn-success col-sm-offset-2" ng-click="update()"><i class="fa fa-save"></i> Update</button>-->
</form>
</uib-tab>
<!-- <uib-tab heading="Permission" ng-if="org.type == 0">
<form class="form-horizontal margin-top" name="org_permission_form">
<div class="form-group">
<label class="col-xs-4 col-sm-2 control-label">Client Rate Editable</label>
<div class="col-xs-8 col-sm-8">
<input type="checkbox" ng-model="org.rate_editable" bs-switch switch-change="toggleRateEditable()">
</div>
</div>
</form>
</uib-tab>-->
</uib-tabset>
</div>
</div>
<!-- <div class="box-solid" ng-if="org.type == 0">
<div class="box box-warning">
<div class="box-header">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-2">
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<label class="control-label" for="username-filter-input">Username</label>
<input type="text" class="form-control" ng-model="search.username" placeholder="Username" id="username-filter-input">
</div>
<div class="form-group" ng-if="'1'|withRole">
<label class="control-label" for="role-filter-select">Role</label>
<select class="form-control" id="role-filter-select" ng-model="search.role">
<option value="1111111">All</option>
<option value="1">Administrator</option>
<option value="10">Compliance</option>
<option value="100">BD User</option>
<option value="1000">Accountant</option>
<option value="10000">Service</option>
<option value="100000">Account Manager</option>
<option value="1000000">Director</option>
<option value="10000000">Site Manager</option>
<option value="100000000">Developer</option>
</select>
</div>
</form>
<div class="navbar-form navbar-right">
<button class="btn btn-success" type="button" ng-click="newManager()">
<i class="fa fa-plus"></i> New Manager Account
</button>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-body">
<div class="row">
<div class="col-sm-12 table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Username</th>
<th>Display Name</th>
<th>Wechat</th>
<th>Create Time</th>
<th>Email</th>
<th>Roles</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="manager in managers|managersFilter:search">
<td ng-bind="manager.username"></td>
<td ng-bind="manager.display_name"></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;"><img ng-src="{{manager.headimg}}" style="height: 30px;width:30px;" class="img-circle" ng-if="manager.headimg"> {{manager.nickname}}</td>
<td ng-bind="manager.create_time|date:'yyyy-MM-dd'"></td>
<td ng-bind="manager.email"></td>
<td>
<i class="fa fa-user-secret" title="Administrator" ng-class="{'text-green':manager.admin,'text-gray':!manager.admin}"></i>
<i class="fa fa-eye" title="Compliance" ng-class="{'text-green':manager.operator,'text-gray':!manager.operator}"></i>
<i class="fa fa-crosshairs" title="BD User" ng-class="{'text-green':manager.bd,'text-gray':!manager.bd}"></i>
<i class="fa fa-balance-scale" title="Accountant" ng-class="{'text-green':manager.finacial,'text-gray':!manager.finacial}"></i>
<i class="fa fa-tty" title="Service" ng-class="{'text-green':manager.sevant,'text-gray':!manager.servant}"></i>
<i class="fa fa-university" title="Account Manager" ng-class="{'text-green':manager.accountmanager,'text-gray':!manager.accountmanager}"></i>
<i class="fa fa-line-chart" title="Director" ng-class="{'text-green':manager.director,'text-gray':!manager.director}"></i>
<i class="fa fa-map-o" title="Site Manager" ng-class="{'text-green':manager.sitemanager,'text-gray':!manager.sitemanager}"></i>
<i class="fa fa-code" title="Developer" ng-class="{'text-green':manager.developer,'text-gray':!manager.developer}"></i>
</td>
<td>
<a role="button" class="text-bold text-primary" ng-click="modifyManager(manager)">Modify</a>
|
<a class="text-bold text-danger" role="button" ng-click="disableManager(manager)">Disable</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>-->
</section>

@ -161,11 +161,15 @@
<td> <td>
<div ng-if="org.is_valid==1"> <div ng-if="org.is_valid==1">
<a role="button" class="text-bold text-primary" <a role="button" class="text-bold text-primary"
ui-sref=".detail({orgId:org.org_id})"><i ui-sref=".detail({orgId:org.org_id})" ng-if="(currentUser.org_id == null) || (org.parent_org_id == currentUser.org_id)"><i
class="fa fa-edit"></i> Edit</a> class="fa fa-edit"></i> Edit |</a>
|
<a role="button" class="text-bold text-danger" <a role="button" class="text-bold text-danger"
ng-click="disableOrg(org)">Disable</a> ng-click="disableOrg(org)" ng-if="(currentUser.org_id == null)||(org.parent_org_id == currentUser.org_id)">Disable</a>
<a role="button" class="text-bold text-primary"
ui-sref=".detail_parent({orgId:org.org_id})" ng-if="org.org_id==currentUser.org_id">Detail</a>
</div> </div>
</td> </td>
</tr> </tr>

Loading…
Cancel
Save