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 app.controller('parentDictGridController', function ($scope, FWDictionaryService,modalService, $modal, PapUrlService){
24 $( "#dialog" ).hide();
27 PapUrlService.getPapUrl().then(function(data) {
29 papUrl = config.PAP_URL;
32 FWDictionaryService.getParentListDictionaryData(papUrl).then(function (data) {
34 $scope.data = JSON.parse(j.data);
35 console.log($scope.data);
36 $scope.fwDictListDictionaryDatas = JSON.parse($scope.data.fwDictListDictionaryDatas);
37 console.log($scope.fwDictListDictionaryDatas);
39 console.log("failed");
45 $scope.parentDictionaryGrid = {
46 data : 'fwDictListDictionaryDatas',
47 enableFiltering: true,
48 exporterCsvFilename: 'ParentList.csv',
50 enableSelectAll: true,
52 field: 'id', enableFiltering: false, headerCellTemplate: '' +
53 '<button id=\'New\' ng-click="grid.appScope.createNewFWParentListWindow()" class="btn btn-success">' + 'Create</button>',
55 '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editFWParentListWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' +
56 '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteFWParentList(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%'
57 },{ field: 'parentItemName', displayName : 'Parent Name'},
58 { field: 'description', displayName : 'Description' },
59 { field: 'addressList', displayName : 'Address List' },
60 { field: 'serviceList', displayName : 'Service List' }
62 exporterPdfDefaultStyle: {fontSize: 9},
63 exporterPdfTableStyle: {margin: [30, 30, 30, 30]},
64 exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'},
65 exporterPdfHeader: { text: "My Header", style: 'headerStyle' },
66 exporterPdfFooter: function ( currentPage, pageCount ) {
67 return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' };
69 exporterPdfCustomFormatter: function ( docDefinition ) {
70 docDefinition.styles.headerStyle = { fontSize: 22, bold: true };
71 docDefinition.styles.footerStyle = { fontSize: 10, bold: true };
74 exporterPdfOrientation: 'portrait',
75 exporterPdfPageSize: 'LETTER',
76 exporterPdfMaxGridWidth: 500,
77 exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")),
78 onRegisterApi: function(gridApi){
79 $scope.gridApi = gridApi;
83 $scope.editParentList = null;
84 $scope.createNewFWParentListWindow = function(){
85 $scope.editParentList = null;
86 var modalInstance = $modal.open({
87 backdrop: 'static', keyboard: false,
88 templateUrl : 'add_fwParentList_popup.html',
89 controller: 'editFWParentListController',
91 message: function () {
93 fwDictListDictionaryDatas: $scope.editParentList
99 modalInstance.result.then(function(response){
100 console.log('response', response);
101 $scope.fwDictListDictionaryDatas=response.fwDictListDictionaryDatas;
105 $scope.editFWParentListWindow = function(fwDictListDictionaryData) {
106 $scope.editParentList = fwDictListDictionaryData;
107 var modalInstance = $modal.open({
108 backdrop: 'static', keyboard: false,
109 templateUrl : 'add_fwParentList_popup.html',
110 controller: 'editFWParentListController',
112 message: function () {
114 fwDictListDictionaryData: $scope.editParentList
120 modalInstance.result.then(function(response){
121 console.log('response', response);
122 $scope.fwDictListDictionaryDatas = response.fwDictListDictionaryDatas;
126 $scope.deleteFWParentList = function(data) {
127 modalService.popupConfirmWin("Confirm","You are about to delete the Parent List: "+data.parentItemName+". Do you want to continue?",
129 var uuu = papUrl + "/ecomp/fw_dictionary/remove_FWDictionaryList.htm";
130 var postData={data: data};
135 contentType: 'application/json',
136 data: JSON.stringify(postData),
137 success : function(data){
138 $scope.$apply(function(){$scope.fwDictListDictionaryDatas=data.fwDictListDictionaryDatas;});
140 error : function(data){
142 modalService.showFailure("Fail","Error while deleting: "+ data.responseText);