-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Add] Admin user page and admin project page of certain user
Add and edit admin page to search information about certain user.
- Loading branch information
Showing
8 changed files
with
183 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
(function () { | ||
angular | ||
.module('pms') | ||
.controller('AdminUsersModifyController', AdminUsersModifyController); | ||
|
||
// admin/users 컨트롤러 | ||
function AdminUsersModifyController($log, $http, $window, $sessionStorage, $location, $stateParams) { | ||
const vm = this; | ||
|
||
vm.log = $log.log; | ||
vm.stateParams = $stateParams; | ||
vm.session = $sessionStorage.getObject('session'); | ||
vm.query = { | ||
order: 'pid', | ||
limit: 7, | ||
page: 1 | ||
}; | ||
$http.get('/rest/session').then((result) => { | ||
if (result.data.auth === 1) { vm.user = 'admin'; } else if (result.data.auth === 0 && result.data.auth > 1) { vm.user = 'user'; } | ||
}); | ||
|
||
$http.get('/rest/session').then(successCallback, errorCallback); | ||
function successCallback(response) { | ||
if (response.data.auth === 1) vm.state = 'admin'; | ||
else if (response.data.auth === 0 && response.data.auth > 1) vm.state = 'user'; | ||
} | ||
|
||
function errorCallback(error) { | ||
vm.log(error, 'can not get data.'); | ||
} | ||
vm.initModify = () => { | ||
if (vm.stateParams.modify_id != null) { | ||
// 유저 데이터 불러오기 | ||
$http.get(`/rest/admin/user/${vm.stateParams.modify_id}`).then((response) => { | ||
if (response.data.error) { | ||
alert('글이 존재하지 않습니다.'); | ||
} | ||
vm.user = response.data.user; | ||
vm.proj = response.data.project; | ||
}); | ||
} | ||
}; | ||
// 유저 수정 | ||
vm.modify = () => { | ||
$http.put(`/rest/admin/user/${vm.stateParams.modify_id}`, { | ||
uid: vm.user.uid, | ||
name: vm.user.name, | ||
auth: vm.user.auth, | ||
email: vm.user.email, | ||
ph: vm.user.ph | ||
}); | ||
$location.path('/admin/users'); | ||
}; | ||
} | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<div ng-controller="AdminUsersModifyController as adminModify"> | ||
<div ng-init="adminModify.initModify()"> | ||
<form ng-submit="adminModify.modify()"> | ||
<md-card> | ||
<div> | ||
<h3 style="text-align: center">User</h3> | ||
<hr class="title_line"> | ||
<h2>Id</h2> | ||
<input type="text" class="" ng-model="adminModify.user.uid" value="{{adminModify.user.uid}}"> | ||
<hr> | ||
</div> | ||
<div> | ||
<h2>Name</h2> | ||
<input type="text" class="" ng-model="adminModify.user.name" value="{{adminModify.user.name}}"> | ||
<hr> | ||
</div> | ||
<div> | ||
<h2>auth</h2> | ||
<input type="text" class="" ng-model="adminModify.user.auth" value="{{adminModify.user.auth}}"> | ||
<hr> | ||
</div> | ||
<div> | ||
<h2>Email</h2> | ||
<input type="text" class="" ng-model="adminModify.user.email" value="{{adminModify.user.email}}"> | ||
<hr> | ||
</div> | ||
<div> | ||
<h2>Phone</h2> | ||
<input type="text" class="" ng-model="adminModify.user.ph" value="{{adminModify.user.ph}}"> | ||
<hr> | ||
</div> | ||
</md-card> | ||
<md-card> | ||
<div> | ||
<h3 style="text-align: center">Project</h3> | ||
<hr class="title_line"> | ||
<md-table-container> | ||
<table md-table class="table_notice"> | ||
<thead md-head md-order="adminUsers.query.order"> | ||
<tr md-row> | ||
<th md-column md-numeric md-order-by="uid" colspan="2"><span class="table_title">ID</span></th> | ||
<th md-column md-numeric md-order-by="name"><span class="table_title">Project Name</span></th> | ||
</tr> | ||
</thead> | ||
<tbody md-bodylayout="row"> | ||
<tr md-row | ||
ng-repeat="proj in adminModify.proj | orderBy: adminModify.query.order | limitTo: adminModify.query.limit : (adminModify.query.page -1) * adminModify.query.limit"> | ||
|
||
<td md-cell class="breakall" colspan="2">{{proj.pid}}</td> | ||
<td md-cell class="breakall">{{proj.project.name}}</td> | ||
<td md-cell><md-button class="md-primary" a ui-sref="adminModify({ modify_id: user.uid })">View</md-button> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</md-table-container> | ||
</div> | ||
</md-card> | ||
<md-card> | ||
<md-button type="submit" class="md-raised"><i class="fa fa-edit">Edit</i></md-button> | ||
</md-card> | ||
</form> | ||
</div> | ||
</div> |
Oops, something went wrong.