2 ================================================================================
4 ================================================================================
5 Copyright (C) 2017 AT&T Intellectual Property
6 ================================================================================
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 ================================================================================
21 <%-- <%@ include file="/WEB-INF/fusion/jsp/include.jsp" %> --%>
23 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
24 <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
25 <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
27 <%@ include file="/WEB-INF/fusion/jsp/popup_modal_rolefunction.html" %>
28 <%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %>
29 <div ng-controller="roleFunctionListController" >
30 <div class="pageTitle">
32 <h1 class="heading1" style="margin-top:20px;">Role Functions</h1>
34 <a ng-click="addNewRoleFunctionModalPopup();" class="icon-add" size="small" ></a>
40 Click on the edit icon to update a role function, the plus icon to add additional role functions, or the delete icon to remove them.
42 <div id="rolesTable" title="Role Functions">
43 <table att-table table-data="availableRoleFunctions" current-page="1">
44 <thead att-table-row type="header">
46 <th att-table-header width="70%">Name</th>
47 <th att-table-header width="10%">Code</th>
48 <th att-table-header width="10%">Edit?</th>
49 <th att-table-header width="10%">Delete?</th>
52 <tbody att-table-row type="body" row-repeat="availableRoleFunction in availableRoleFunctions" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody-->
54 <td att-table-body width="70%">{{ availableRoleFunction.name }}</td>
55 <td att-table-body width="10%">{{ availableRoleFunction.code }}</td>
56 <td att-table-body width="10%">
57 <!-- <a ng-click="editRoleFunctionPopup(availableRoleFunction);" >
58 <img src="static/fusion/images/editicon.gif">
60 <div ng-click="editRoleFunctionModalPopup(availableRoleFunction);" style="font-size:20px;"><a href="javascript:void(0)" class="icon-edit"></a></div>
62 <td att-table-body width="10%">
63 <!-- <a ng-click="removeRole(availableRoleFunction);" ><img src="static/fusion/images/deleteicon.gif"></a> -->
64 <div ng-click="removeRole(availableRoleFunction);" style="font-size:20px;"><a href="javascript:void(0)" class="icon-trash"></a></div>
71 <!-- <div align="left" style="marin-bottom: 50px;"> -->
72 <!-- <button type="submit" onClick="window.location='role_function.htm';" att-button -->
73 <!-- btn-type="primary" size="small">Create</button> -->
76 <div id="dialog" title="Add Role Function">
78 <div class="fn-ebz-container" >
79 <label class="fn-ebz-text-label"><sup><b>*</b></sup>Name:</label><br>
80 <input type="text" class="fn-ebz-text" ng-model="editRoleFunction.name"
84 <div class="fn-ebz-container" >
85 <label class="fn-ebz-text-label"><sup><b>*</b></sup>Code:</label><br>
86 <input type="text" class="fn-ebz-text" ng-model="editRoleFunction.code" ng-disabled="editRoleFunction.code!=null"
90 <button type="submit" ng-click="saveRoleFunction(editRoleFunction);" att-button
91 btn-type="primary" size="small">Save</button>
101 app.controller('roleFunctionListController', function ($scope, modalService, $modal){
102 $( "#dialog" ).hide();
103 $scope.availableRoleFunctions=${availableRoleFunctions};
106 $scope.editRoleFunction = null;
108 $scope.editRoleFunctionPopup = function(availableRoleFunction) {
109 $scope.editRoleFunction = availableRoleFunction;
110 $( "#dialog" ).dialog({
115 $scope.editRoleFunctionModalPopup = function(availableRoleFunction) {
116 $scope.editRoleFunction = availableRoleFunction;
117 var modalInstance = $modal.open({
118 templateUrl: 'edit_role_function_popup.html',
119 controller: 'rolefunctionpopupController',
121 message: function () {
123 availableRoleFunction: $scope.editRoleFunction
129 modalInstance.result.then(function(response){
130 console.log('response', response);
131 $scope.availableRoleFunctions=response.availableRoleFunctions;
135 $scope.addNewRoleFunctionModalPopup = function(availableRoleFunction) {
136 $scope.editRoleFunction = null;
137 var modalInstance = $modal.open({
138 templateUrl: 'edit_role_function_popup.html',
139 controller: 'rolefunctionpopupController',
141 message: function () {
143 availableRoleFunction: $scope.editRoleFunction
149 modalInstance.result.then(function(response){
150 console.log('response', response);
151 $scope.availableRoleFunctions=response.availableRoleFunctions;
155 $scope.addNewRoleFunctionPopup = function() {
156 $scope.editRoleFunction = null;
157 $( "#dialog" ).dialog({
162 $scope.saveRoleFunction = function(availableRoleFunction) {
163 var uuu = "role_function_list/saveRoleFunction.htm";
164 var postData={availableRoleFunction: availableRoleFunction};
169 contentType: 'application/json',
170 data: JSON.stringify(postData),
171 success : function(data){
172 $scope.$apply(function(){
173 $scope.availableRoleFunctions=[];$scope.$apply();
174 $scope.availableRoleFunctions=data.availableRoleFunctions;});
175 //alert("Update Successful.") ;
176 console.log($scope.availableRoleFunctions);
178 $scope.editRoleFunction = null;
179 $( "#dialog" ).dialog("close");
181 error : function(data){
182 alert("Error while saving.");
188 $scope.removeRole = function(availableRoleFunction) {
189 modalService.popupConfirmWin("Confirm","You are about to delete the role function "+availableRoleFunction.name+". Do you want to continue?",
191 var uuu = "role_function_list/removeRoleFunction.htm";
192 var postData={availableRoleFunction: availableRoleFunction};
197 contentType: 'application/json',
198 data: JSON.stringify(postData),
199 success : function(data){
200 $scope.$apply(function(){$scope.availableRoleFunctions=data.availableRoleFunctions;});
202 error : function(data){
204 modalService.showFailure("Fail","Error while deleting: "+ data.responseText);