1 var ModalInstanceCtrl = function ($scope, $modalInstance, msg,$rootScope) {
5 var testRunSqlController = function ($scope, $modalInstance, $http, $log, raptorReportFactory, queriedData) {
6 var init = function() {
7 $scope.isError = false;
8 if (queriedData.errormessage) {
10 $scope.errormessage = queriedData.errormessage;
11 $scope.stacktrace = queriedData.stacktrace;
13 $scope.queryData = queriedData;
17 $scope.close = function() {
18 $modalInstance.dismiss();
22 var openColumnPopupController = function ($scope, $modalInstance, $http, $log, raptorReportFactory, colData, $routeParams) {
23 $scope.processingData=true;
25 $scope.drilldownReports={};
26 $scope.isEditCol = true;
27 var init = function() {
28 $scope.displayAlignmentOptions = [
29 {value:"null", text:""},
30 {value:"Left", text:"Left"},
31 {value:"Center", text:"Center"},
32 {value:"Right", text:"Right"}
34 $scope.dataTypeOptions = [
35 {value:"Number", text:"Number"},
36 {value:"Date", text:"Date"},
37 {value:"VARCHAR2", text:"Character"},
38 {value:"Hyperlink", text:"Hyperlink"}
41 $scope.multiGroupColLevel = [
42 {value:"1", text:"1"},
43 {value:"2", text:"2"},
44 {value:"3", text:"3"},
47 $scope.indentValues = [
48 {value:"1", text:"1"},
49 {value:"2", text:"2"},
50 {value:"3", text:"3"},
54 $scope.totalForTheColList= [];
55 raptorReportFactory.getTotalForTheColList().then(function(data){
56 $scope.totalForTheColList = data;
58 $scope.errorPopUp(error);
59 $log.error("raptorReportFactory: retrieveTotalForTheColList failed.");
62 raptorReportFactory.getDrillDownReportList().then(function(data2){
63 $scope.drilldownReports = data2;
64 raptorReportFactory.getColumnEditInfoById(colData.id).then(function(data){
65 $scope.colInfo = data;
66 if($scope.colInfo.noWrap!=null && ($scope.colInfo.noWrap=='Y' || $scope.colInfo.noWrap==true))
67 $scope.colInfo.noWrap=true;
69 $scope.colInfo.noWrap=false;
70 $scope.processingData=false;
73 $scope.errorPopUp(error);
74 $log.error("raptorReportFactory: getColumnEditInfoById failed.");
77 $scope.errorPopUp(error);
78 $log.error("raptorReportFactory: getDrillDownReportList failed.");
81 $scope.massageData = function(){
82 if(!Number.isInteger($scope.colInfo.level))
83 $scope.colInfo.level = null;
84 if(!Number.isInteger($scope.colInfo.indentation))
85 $scope.colInfo.indentation = null;
88 $scope.save = function() {
89 $scope.processingData=true;
90 $scope.colInfo.noWrap=($scope.colInfo.noWrap==true)?'Y':'N';
91 if($scope.colInfo.level && $scope.colInfo.level.startsWith("Select"))
92 $scope.colInfo.level = null;
93 if($scope.colInfo.displayTotal && $scope.colInfo.displayTotal.startsWith("Select"))
94 $scope.colInfo.displayTotal = null;
96 if($scope.colInfo.indentation && $scope.colInfo.indentation.startsWith("Select"))
97 $scope.colInfo.indentation = null;
98 raptorReportFactory.saveColumnEditInfo($scope.colInfo).then(function(data){
99 $scope.successPopUp('');
100 $scope.processingData=false;
101 $modalInstance.close();
103 $scope.errorPopUp(error);
104 $log.error("raptorReportFactory: save failed.");
105 $scope.processingData=false;
109 $scope.cancel = function() {
110 $modalInstance.dismiss();
115 $scope.drilDownValues=[];
116 $scope.childReportFF =[];
117 $scope.childReportCol = [];
118 $scope.complete = function() {
119 var drillDownParams='';
122 for(var i in $scope.selectedDrillReportFormField){
123 var selectedRadio = $scope.selectedDrillReportFormField[i];
124 if( selectedRadio != (i+'-0')){// if it's not 'No Value'
125 if (typeof($scope.drillDownParams[i].fieldName) == "undefined"){
126 if(i>=($scope.drilDownFormField.length-1)){
127 var id = $scope.drilDownFormField[i].id;
128 drillDownParams+= id+"=";
131 drillDownParams+=$scope.drillDownParams[i].fieldName+"=";
132 if( selectedRadio == (i+'-1')){//'Fixed Value'
133 drillDownParams+= $scope.drillDownParams[i].valValue+ampStr;
134 }else if( selectedRadio == (i+'-2')){//'Value of Column'
135 drillDownParams+= ('['+$scope.drillDownParams[i].valColId+']'+ampStr);
136 }else if( selectedRadio == (i+'-3')){//'Value of form field'
137 drillDownParams+= ('[!'+$scope.drillDownParams[i].valFieldId+']'+ampStr);
138 }else if( selectedRadio == (i+'-4')){//'Value set'
139 if($scope.drillDownParams[i].valColId!='' && $scope.drillDownParams[i].valFieldId!='' && $scope.drillDownParams[i].valColId!='Select' && $scope.drillDownParams[i].valFieldId!='Select')
140 drillDownParams+= ('['+$scope.drillDownParams[i].valColId+'!'+$scope.drillDownParams[i].valFieldId+']'+ampStr);
144 drillDownParams = drillDownParams.substring(0, drillDownParams.length - 1);
145 $scope.colInfo.drilldownParams = drillDownParams;
146 $scope.isEditCol=true;
148 $scope.selectedDrillReportFormField = [];
149 $scope.drillDownParams = {};
150 $scope.getDrillReportFormField = function(ddReportId,param){
151 $scope.isEditCol = false;
152 $scope.processingData = true;
154 raptorReportFactory.getChildReportFormField(ddReportId).then(function(data){
155 $scope.drilDownFormField = data;
158 {selection: 'No Value', value:'Accept Default', radioGroup :i+'-'+'0'},
159 {selection: 'Fixed Value', value:'Accept Default' , radioGroup :i+'-'+'1'},
160 {selection: 'Value of Column', value:'Accept Default', radioGroup :i+'-'+'2'},
161 {selection: 'Value of form field', value:'Accept Default', radioGroup :i+'-'+'3'},
162 {selection: 'Value set', value:'Pass the value of the selected column if not empty, otherwise pass the value of the selected form field', radioGroup :i+'-'+'4'}
164 $scope.drilDownValues.push(array);
168 raptorReportFactory.getDrillDownParamDef(param).then(function(dataDD){
169 var temp = $scope.drilDownFormField;
170 $scope.drillDownParams = [];
171 for(var i in $scope.drilDownFormField){
172 $scope.selectedDrillReportFormField[i] = i+'-0';
174 fieldName: $scope.drilDownFormField[i].id,
180 $scope.drillDownParams.push(tmp);
182 for(var i in $scope.drilDownFormField){
183 for(var j in dataDD){
184 if($scope.drilDownFormField[i].id == dataDD[j].fieldName){
185 $scope.selectedDrillReportFormField[i] = i+'-'+dataDD[j].valType;
186 $scope.drillDownParams[i] = dataDD[j];
191 $scope.errorPopUp(error);
192 $log.error("raptorReportFactory: getChildReportFormField failed.");
193 }).finally(function() {
194 $scope.processingData=false;
197 $scope.processingData = false;
200 $scope.errorPopUp(error);
201 $log.error("raptorReportFactory: getChildReportFormField failed.");
204 raptorReportFactory.getChildReportFormField($scope.colInfo.drilldownURL).then(function(data){
205 $scope.childReportFF =data;
207 $scope.errorPopUp(error);
208 $log.error("raptorReportFactory: getChildReportFormField failed.");
211 raptorReportFactory.getChildReportColumn($routeParams.reportId).then(function(data){
212 $scope.childReportCol =data;
214 $scope.errorPopUp(error);
215 $log.error("raptorReportFactory: getChildReportFormField failed.");
221 var openFormFieldPopupController = function ($scope, $modalInstance, $http, $log, raptorReportFactory, fieldData) {
222 $scope.formFieldEditData = {};
223 $scope.sqlAsDefaultValue ={
226 $scope.predefinedValues ={
229 var init = function() {
230 if($scope.type=='edit'){
231 $scope.dataProcessing = true;
232 raptorReportFactory.getFormFieldEditInfoById(fieldData.id).then(function(data){
233 $scope.dataProcessing = false;
234 $scope.formFieldEditData = data;
235 if($scope.formFieldEditData.fieldDefaultSQL)
236 $scope.sqlAsDefaultValue.value = true;
238 $scope.errorPopUp(error);
239 $log.error("raptorReportFactory: getColumnEditInfoById failed.");
240 }).finally(function() {
241 $scope.dataProcessing=false;
244 $scope.formFieldEditData ={
245 groupFormField: false,
250 {value:"true", text:"Yes"},
251 {value:"false", text:"No"}
253 $scope.verifyFieldValueOptions = [
254 {value:null, text:"--- Do Not Perform Validation ---"},
255 {value:"DATE", text:"Date"},
256 {value:"TIMESTAMP_HR", text:"TimeStamp (Hour)"},
257 {value:"TIMESTAMP_MIN", text:"TimeStamp (Hour,Min)"},
258 {value:"TIMESTAMP_SEC", text:"TimeStamp (Hour,Min,Sec)"},
259 {value:"INTEGER", text:"Integer"},
260 {value:"POSITIVE_INTEGER", text:"Positive Integer"},
261 {value:"NON_NEGATIVE_INTEGER", text:"Positive Integer. Cannot Be Zero"},
262 {value:"FLOAT", text:"Any Number"},
263 {value:"NON_NEGATIVE_FLOAT", text:"Positive Number"},
264 {value:"POSITIVE_FLOAT", text:"Positive Number. Cannot Be Zero"}
266 $scope.fieldTypeOptions = [
267 {value:"TEXT", text:"Text Box"},
268 {value:"LIST_BOX", text:"List Box"},
269 {value:"LIST_MULTI_SELECT", text:"Multi-select List Box"},
270 {value:"HIDDEN", text:"Hidden"}
274 $scope.save = function() {
275 if($scope.sqlAsDefaultValue.value && ($scope.formFieldEditData.fieldDefaultSQL==null || $scope.formFieldEditData.fieldDefaultSQL=='')){
276 $scope.errorPopUp("if SQL as Default Value is checked, 'Default SQL' and 'SQL Generating Custom List of Values' fields cannot be empty");
278 }else if(!$scope.sqlAsDefaultValue.value){
279 $scope.formFieldEditData.fieldDefaultSQL=null;
281 $scope.dataProcessing = true;
282 console.log($scope.formFieldEditData.validationType);
283 if($scope.formFieldEditData.validationType=='Select')
284 $scope.formFieldEditData.validationType = '';
285 raptorReportFactory.saveFormFieldEditInfo($scope.formFieldEditData).then(function(data){
286 $scope.dataProcessing = false;
287 $scope.successPopUp('');
288 $modalInstance.close();
290 $scope.errorPopUp(error);
291 $log.error("raptorReportFactory: saveFormFieldEditInfo failed.");
292 }).finally(function() {
293 $scope.dataProcessing=false;
297 $scope.add = function() {
298 $scope.dataProcessing = true;
299 $scope.formFieldEditData.visible==
300 raptorReportFactory.addFormFieldEditInfo($scope.formFieldEditData).then(function(data){
301 $scope.dataProcessing = false;
302 $modalInstance.close();
304 $scope.errorPopUp(error);
305 $log.error("raptorReportFactory: add FormFieldEditInfo failed.");
306 }).finally(function() {
307 $scope.dataProcessing=false;
311 $scope.addPredefinedValueList = function() {
312 if($scope.formFieldEditData.predefinedValueList==null)
313 $scope.formFieldEditData.predefinedValueList=[];
315 id:$scope.predefinedValues.value,
316 name:$scope.predefinedValues.value,
319 if($scope.predefinedValues.value!=null && $scope.predefinedValues.value!='')
320 $scope.formFieldEditData.predefinedValueList.push(item);
323 $scope.removePredefinedValueList = function(removeVal) {
324 var removeIndex = null;
325 for(i in $scope.formFieldEditData.predefinedValueList){
326 if($scope.formFieldEditData.predefinedValueList[i].id == removeVal){
331 $scope.formFieldEditData.predefinedValueList.splice(removeIndex, 1)
334 $scope.cancel = function() {
335 $modalInstance.dismiss();
340 var deleteFormFieldController = function ($scope, $modalInstance, $http, $log, raptorReportFactory, rowData) {
341 $scope.tempFieldId = rowData.id;
342 $scope.ok = function() {
343 raptorReportFactory.deleteFormFieldById(rowData.id).then(function(data){
344 $modalInstance.close();
346 $scope.errorPopUp(error);
347 $log.error("raptorReportFactory: deleteFormFieldById failed.");
350 $scope.cancel = function() {
351 $modalInstance.dismiss();
355 var removeReportSecurityUserController = function ($scope, $modalInstance, $http, $log, raptorReportFactory,securityUser) {
356 $scope.securityUserName = securityUser.name;
357 $scope.ok = function() {
358 raptorReportFactory.removeReportSecurityUser(securityUser.id).then(function(data){
359 $modalInstance.close();
361 $scope.errorPopUp(error);
362 $log.error("raptorReportFactory: removeReportSecurityUser failed.");
365 $scope.cancel = function() {
366 $modalInstance.dismiss();
370 var removeReportSecurityRoleController = function ($scope, $modalInstance, $http, $log, raptorReportFactory,securityRole) {
371 $scope.securityRoleName = securityRole.name;
372 $scope.ok = function() {
373 raptorReportFactory.removeReportSecurityRole(securityRole.id).then(function(data){
374 $modalInstance.close();
376 $scope.errorPopUp(error);
377 $log.error("raptorReportFactory: removeReportSecurityRole failed.");
380 $scope.cancel = function() {
381 $modalInstance.dismiss();
385 var formFieldVerifySQLController = function ($scope, $modalInstance, $http, $log, raptorReportFactory, queriedData) {
386 var init = function() {
387 $scope.isError = false;
388 if (queriedData.errormessage) {
389 $scope.isError = true;
390 $scope.errormessage = queriedData.errormessage;
391 $scope.stacktrace = queriedData.stacktrace;
393 $scope.queryData = queriedData;
397 $scope.close = function() {
398 $modalInstance.dismiss();
401 var toggleUserEditAccessActiveController = function ($scope, $modalInstance, $http, $log, raptorReportFactory, rowData) {
402 $scope.rowData = rowData;
403 $scope.toggleEditAccessStatus = function(rowData) {
404 raptorReportFactory.toggleUserEditAccess(rowData);
405 $modalInstance.close();
408 $scope.cancelEditAccessToggle = function(rowData) {
409 rowData.accessAllowed = ! rowData.accessAllowed;
410 $modalInstance.dismiss('cancel');}
413 var toggleRoleEditAccessActiveController = function ($scope, $modalInstance, $http, $log, raptorReportFactory, rowData) {
414 $scope.rowData = rowData;
415 $scope.toggleEditAccessStatus = function(rowData) {
416 raptorReportFactory.toggleRoleEditAccess(rowData);
417 $modalInstance.close();
420 $scope.cancelEditAccessToggle = function(rowData) {
421 rowData.accessAllowed = ! rowData.accessAllowed;
422 $modalInstance.dismiss('cancel');}