Commit 702bdf6e authored by Sang D NGO's avatar Sang D NGO
Browse files

only expert can give review

parent 77523c31
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
.modal-header .modal-header
button.close(type="button", data-dismiss="modal", aria-label="Close", ng-click="$hide()") button.close(type="button", data-dismiss="modal", aria-label="Close", ng-click="$hide()")
span(aria-hidden="true") × span(aria-hidden="true") ×
h4.modal-title #{__('Thiết lập chuyên gia')} h4.modal-title #{__('Hỏi chuyên gia')}
.modal-body .modal-body
p p
| #{__('Chọn một nhóm chuyên gia:')} | #{__('Chọn một nhóm chuyên gia:')}
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
$modal, $modal,
$stateParams, $stateParams,
session, session,
mostProposalApiClient mostProposalApiClient,
mostRoleService
) { ) {
var self = this; var self = this;
...@@ -20,7 +21,8 @@ ...@@ -20,7 +21,8 @@
self.onReviewBtnClick = onReviewBtnClick; self.onReviewBtnClick = onReviewBtnClick;
function $onInit() { function $onInit() {
self.showAction = session.userIsDomainAdministrator(); self.userRole = mostRoleService.getRole();
mostProposalApiClient.getProposal($stateParams.proposalId) mostProposalApiClient.getProposal($stateParams.proposalId)
.then(function(proposal) { .then(function(proposal) {
self.proposal = proposal; self.proposal = proposal;
......
sub-header sub-header
most-proposal-detail-subheader( most-proposal-detail-subheader(
data-title="$ctrl.proposal.formJson.title", data-title="$ctrl.proposal.formJson.title",
show-action="$ctrl.showAction", user-role="$ctrl.userRole",
on-reject-btn-click="$ctrl.onRejectBtnClick()", on-reject-btn-click="$ctrl.onRejectBtnClick()",
on-set-experts-btn-click="$ctrl.onSetExpertsBtnClick()", on-set-experts-btn-click="$ctrl.onSetExpertsBtnClick()",
on-accept-btn-click="$ctrl.onAcceptBtnClick()", on-accept-btn-click="$ctrl.onAcceptBtnClick()",
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
templateUrl: '/linagora.esn.most/app/proposal/detail/subheader/most-proposal-detail-subheader.html', templateUrl: '/linagora.esn.most/app/proposal/detail/subheader/most-proposal-detail-subheader.html',
bindings: { bindings: {
title: '<', title: '<',
showAction: '<', userRole: '<',
onRejectBtnClick: '&', onRejectBtnClick: '&',
onReviewBtnClick: '&', onReviewBtnClick: '&',
onSetExpertsBtnClick: '&', onSetExpertsBtnClick: '&',
......
...@@ -5,17 +5,17 @@ block left ...@@ -5,17 +5,17 @@ block left
span.title.ellipsis {{::$ctrl.title}} span.title.ellipsis {{::$ctrl.title}}
block right block right
ul.actions.flex-space-around(ng-if="$ctrl.showAction") ul.actions.flex-space-around(ng-if="$ctrl.userRole !== 'user'")
li.contact-dropdown.dropdown li.contact-dropdown.dropdown
a(href='', data-toggle='dropdown') a(href='', data-toggle='dropdown')
i.mdi.mdi-dots-vertical i.mdi.mdi-dots-vertical
ul.dropdown-menu.dropdown-menu-right ul.dropdown-menu.dropdown-menu-right
li li(ng-if="$ctrl.userRole === 'moderator'")
a(href='', ng-click='$ctrl.onRejectBtnClick()') Từ chối
li
a(href='', ng-click='$ctrl.onSetExpertsBtnClick()') Thiết lập chuyên gia
li
a(href='', ng-click='$ctrl.onAcceptBtnClick()') Duyệt a(href='', ng-click='$ctrl.onAcceptBtnClick()') Duyệt
li li(ng-if="$ctrl.userRole === 'moderator'")
a(href='', ng-click="$ctrl.onReviewBtnClick()") Nhận xét và đánh giá a(href='', ng-click='$ctrl.onRejectBtnClick()') Từ chối
li(ng-if="$ctrl.userRole === 'moderator'")
a(href='', ng-click='$ctrl.onSetExpertsBtnClick()') Hỏi chuyên gia
li(ng-if="$ctrl.userRole === 'expert'")
a(href='', ng-click="$ctrl.onReviewBtnClick()") Nhận xét
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
function MostProposalController( function MostProposalController(
$stateParams, $stateParams,
session, mostRoleService,
mostProposalApiClient mostProposalApiClient
) { ) {
var self = this; var self = this;
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
function $onInit() { function $onInit() {
self.status = 'loading'; self.status = 'loading';
self.showCreateBtn = !session.userIsDomainAdministrator(); self.showCreateBtn = mostRoleService.getRole() === 'user';
mostProposalApiClient.getProposals({ status: $stateParams.status }).then(function(proposals) { mostProposalApiClient.getProposals({ status: $stateParams.status }).then(function(proposals) {
self.status = 'loaded'; self.status = 'loaded';
......
(function(angular) {
'use strict';
angular.module('linagora.esn.most')
.factory('mostRoleService', mostRoleService);
function mostRoleService(
session
) {
return {
getRole: getRole
};
function getRole() {
if (userIsExpert()) {
return 'expert';
}
if (session.userIsDomainAdministrator()) {
return 'moderator';
}
return 'user';
}
function userIsExpert() {
return session.user.preferredEmail.indexOf('chuyengia') === 0;
}
}
})(angular);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment