2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018, 2019 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=========================================================
21 app.controller('policyDashboardCRUDDataController', function ($scope, PolicyAppService, modalService, $modal){
23 $('#dashBoardAdvanceSearch').hide();
25 $scope.papCRUDTableDatasTemp = [];
27 $scope.dashboardAdsearch = { isDelected: 'both', stage: 'both', scope: "", ttlDate_after: "", ttlDate_before: ""};
29 PolicyAppService.getData('get_DashboardPolicyCRUDData').then(function(data){
32 $scope.data = JSON.parse(j.data);
33 $scope.papStatusCRUDDatas =JSON.parse($scope.data.papStatusCRUDData);
34 if($scope.papStatusCRUDDatas != null){
35 for(i = 0; i < $scope.papStatusCRUDDatas.length; i++){
36 $scope.papCRUDTableDatasTemp.push($scope.papStatusCRUDDatas[i].map);
39 $scope.papCRUDTableDatas = $scope.papCRUDTableDatasTemp;
44 $scope.papCRUDStatusDatas = {
45 data : 'papCRUDTableDatas',
46 enableFiltering: true,
47 columnDefs: [{ field: 'id', displayName :'id'},
48 {field: 'scope', displayName :'Scope'},
49 {field: 'policyName', displayName :'Policy Name'},
50 {field: 'version', displayName :'Version'},
51 {field: 'stage', displayName :'Stage'},
52 {field: 'createdBy', displayName :'Created By'},
53 {field: 'deleted', displayName :'Deleted'},
54 {field: 'deleteReasonCode', displayName :'Deleted Reason'},
55 {field: 'deletedBy' , displayName :'Deleted By'},
56 {field: 'modifiedBy' , displayName :'Modified By'},
57 {field: 'createdDate', displayName :'Created Date'},
58 {field: 'modifiedDate', displayName :'Modified Date'}
60 onRegisterApi: function(gridApi){
61 $scope.gridApi = gridApi;
65 $('#ttlDate_after').datepicker({
66 dateFormat: 'yy-mm-dd',
69 onSelect: function(date) {
70 angular.element($('#ttlDate_after')).triggerHandler('input');
74 $('#ttlDate_before').datepicker({
75 dateFormat: 'yy-mm-dd',
78 onSelect: function(date) {
79 angular.element($('#ttlDate_before')).triggerHandler('input');
83 $scope.refresh = function(){
84 $scope.modal('advancedSearch', true);
85 $scope.temp.policy = "";
89 $scope.advancedSearch = function(){
91 $('#dashBoardAdvanceSearch').toggle();
92 if($('#advancedSearchArrow').hasClass('arrowdown')){
93 $('#advancedSearchArrow').removeClass("arrowdown");
94 $('#advancedSearchArrow').addClass("arrowup");
97 $('#advancedSearchArrow').removeClass("arrowup");
98 $('#advancedSearchArrow').addClass("arrowdown");
103 $scope.startAdvancedSearch = function(data){
106 if(data.scope == null){
110 var uuu = "dashboardController/dashboardAdvancedSearch.htm";
112 var postData={policyData: data};
117 contentType: 'application/json',
118 data: JSON.stringify(postData),
119 success : function(data){
121 $scope.$apply(function(){
124 $scope.data = JSON.parse(j.data);
125 $scope.papStatusCRUDDatas =JSON.parse($scope.data.policyStatusCRUDData);
127 $scope.papCRUDTableDatasTemp = [];
129 for(i = 0; i < $scope.papStatusCRUDDatas.length; i++){
130 $scope.papCRUDTableDatasTemp.push($scope.papStatusCRUDDatas[i].map);
133 $scope.papCRUDTableDatas = $scope.papCRUDTableDatasTemp;
135 $scope.gridApi.grid.refresh();
138 error : function(data){