2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
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 * ============LICENSE_END=========================================================
23 var editBRMSParamController = function ($scope, $modalInstance, message, $http, PapUrlService, UserInfoService, Notification){
24 if(message.brmsParamDictionaryData==null)
25 $scope.label='Add BRMS Rule'
27 $scope.label='Edit BRMS Rule'
28 $scope.disableCd=true;
32 PapUrlService.getPapUrl().then(function(data) {
34 papUrl = config.PAP_URL;
38 /*getting user info from session*/
40 UserInfoService.getFunctionalMenuStaticDetailSession()
41 .then(function (response) {
42 loginId = response.userid;
45 $scope.editBRMSParam = message.brmsParamDictionaryData;
47 $scope.uploadFile = function(files) {
48 var fd = new FormData();
49 fd.append("file", files[0]);
50 $http.post(papUrl + "/ecomp/brms_dictionary/set_BRMSParamData.htm", fd, {
51 withCredentials: false,
52 headers: {'Content-Type': undefined },
53 transformRequest: angular.identity
54 }).success().error( );
59 $scope.saveBRMSParam = function(brmsParamDictionaryData) {
60 var file = $scope.MyFile;
61 var uuu = papUrl + "/ecomp/brms_dictionary/save_BRMSParam.htm";
62 var postData={brmsParamDictionaryData: brmsParamDictionaryData, loginId: loginId};
67 contentType: 'application/json',
68 data: JSON.stringify(postData),
69 success : function(data){
70 $scope.$apply(function(){
71 $scope.brmsParamDictionaryDatas=data.brmsParamDictionaryDatas;});
72 if($scope.brmsParamDictionaryDatas == "Duplicate"){
73 Notification.error("BRMSParan Dictionary exists with Same Name.")
75 console.log($scope.brmsParamDictionaryDatas);
76 $modalInstance.close({brmsParamDictionaryDatas:$scope.brmsParamDictionaryDatas});
79 error : function(data){
80 alert("Error while saving.");
85 $scope.close = function() {
86 $modalInstance.close();