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 @@
.modal-header
button.close(type="button", data-dismiss="modal", aria-label="Close", ng-click="$hide()")
span(aria-hidden="true") ×
h4.modal-title #{__('Thiết lập chuyên gia')}
h4.modal-title #{__('Hỏi chuyên gia')}
.modal-body
p
| #{__('Chọn một nhóm chuyên gia:')}
......
......@@ -9,7 +9,8 @@
$modal,
$stateParams,
session,
mostProposalApiClient
mostProposalApiClient,
mostRoleService
) {
var self = this;
......@@ -20,7 +21,8 @@
self.onReviewBtnClick = onReviewBtnClick;
function $onInit() {
self.showAction = session.userIsDomainAdministrator();
self.userRole = mostRoleService.getRole();
mostProposalApiClient.getProposal($stateParams.proposalId)
.then(function(proposal) {
self.proposal = proposal;
......
sub-header
most-proposal-detail-subheader(
data-title="$ctrl.proposal.formJson.title",
show-action="$ctrl.showAction",
user-role="$ctrl.userRole",
on-reject-btn-click="$ctrl.onRejectBtnClick()",
on-set-experts-btn-click="$ctrl.onSetExpertsBtnClick()",
on-accept-btn-click="$ctrl.onAcceptBtnClick()",
......
......@@ -7,7 +7,7 @@
templateUrl: '/linagora.esn.most/app/proposal/detail/subheader/most-proposal-detail-subheader.html',
bindings: {
title: '<',
showAction: '<',
userRole: '<',
onRejectBtnClick: '&',
onReviewBtnClick: '&',
onSetExpertsBtnClick: '&',
......
......@@ -5,17 +5,17 @@ block left
span.title.ellipsis {{::$ctrl.title}}
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
a(href='', data-toggle='dropdown')
i.mdi.mdi-dots-vertical
ul.dropdown-menu.dropdown-menu-right
li
a(href='', ng-click='$ctrl.onRejectBtnClick()') Từ chối
li
a(href='', ng-click='$ctrl.onSetExpertsBtnClick()') Thiết lập chuyên gia
li
li(ng-if="$ctrl.userRole === 'moderator'")
a(href='', ng-click='$ctrl.onAcceptBtnClick()') Duyệt
li
a(href='', ng-click="$ctrl.onReviewBtnClick()") Nhận xét và đánh giá
li(ng-if="$ctrl.userRole === 'moderator'")
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 @@
function MostProposalController(
$stateParams,
session,
mostRoleService,
mostProposalApiClient
) {
var self = this;
......@@ -15,7 +15,7 @@
function $onInit() {
self.status = 'loading';
self.showCreateBtn = !session.userIsDomainAdministrator();
self.showCreateBtn = mostRoleService.getRole() === 'user';
mostProposalApiClient.getProposals({ status: $stateParams.status }).then(function(proposals) {
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