2 * ================================================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ================================================================================
\r
24 class ContactUsCtrl {
\r
25 constructor($log, contactUsService, applicationsService, $modal, ngDialog, $state,$anchorScroll,$location) {
\r
27 contactUsService.getContactUSPortalDetails().then(res => {
\r
28 // $log.info('ContactUsCtrl:: contactUsService getContactUSPortalDetails res',res);
\r
29 // $log.info('getting res',res);
\r
30 var result = (typeof(res.response) != "undefined" && res.response!=null)?res.response:null;
\r
31 // $log.info('result',result);
\r
32 // $log.info('done');
\r
33 var source = JSON.parse(result);
\r
34 // $log.info(source);
\r
35 this.ush_TicketInfoUrl = source.ush_ticket_url;
\r
36 this.portalInfo_Address = source.feedback_email_address;
\r
37 this.feedback_Url = source.portal_info_url;
\r
39 $log.error('ContactUsCtrl:error:: ', err);
\r
44 // $log.info('ecomp app::contact-us-controller::initializing...');
\r
46 this.functionalTableData=[];
\r
50 let updateContactUsTable = () => {
\r
51 contactUsService.getAppsAndContacts().then(res=> {
\r
52 // $log.info('ContactUsCtrl:: contactUsService getAppsAndContacts res',res);
\r
54 // $log.info('getting res',res);
\r
55 var result = (typeof(res.response) != "undefined" && res.response!=null)?res.response:null;
\r
56 // $log.info('result',result);
\r
57 // $log.info('done');
\r
58 var source = result;
\r
59 // $log.info(source);
\r
60 // Drop Portal app, empty name entries
\r
61 for(var i=0;i<source.length; i++) {
\r
62 var dataArr = source[i];
\r
63 if ( !dataArr.appName || dataArr.appId == 1) {
\r
67 app_name: dataArr.appName,
\r
68 contact_name: dataArr.contactName,
\r
69 contact_email: dataArr.contactEmail,
\r
70 desc: dataArr.description,
\r
71 url_Info: dataArr.url,
\r
72 app_Id: dataArr.appId,
\r
74 tableData.push(dataTemp);
\r
76 this.appTable=tableData;
\r
78 $log.error('ContactUsCtrl.updateContactUsTable:error:: ', err);
\r
82 contactUsService.getAppCategoryFunctions().then(res=> {
\r
83 // $log.info('ContactUsCtrl:: contactUsService getAppCategoryFunctionsthen res',res);
\r
84 var tablefunctionalData=[];
\r
85 // $log.info('getting res',res);
\r
86 var result = (typeof(res.response) != "undefined" && res.response!=null)?res.response:null;
\r
87 // $log.info('result',result);
\r
88 // $log.info('done');
\r
89 var source = result;
\r
90 // $log.info(source);
\r
91 for(var i=0;i<source.length; i++) {
\r
92 var datafunctionalArr = source[i];
\r
93 var datafuntionalTemp={
\r
94 category: datafunctionalArr.category,
\r
95 app_Name: datafunctionalArr.application,
\r
96 functions: datafunctionalArr.functions,
\r
97 app_Id: datafunctionalArr.appId,
\r
99 tablefunctionalData.push(datafuntionalTemp);
\r
101 this.functionalTableData=tablefunctionalData;
\r
103 $log.error('ContactUsCtrl:error:: ', err);
\r
106 updateContactUsTable();
\r
107 this.editContactUsModalPopup = () => {
\r
108 // $log.debug('ContactUsCtrl::editContactUsModalPopup updating table data...');
\r
109 var modalInstance = ngDialog.open({
\r
110 templateUrl: 'app/views/support/contact-us/contact-us-manage/contact-us-manage.html',
\r
111 controller: 'ContactUsManageController',
\r
113 message: function message() {
\r
120 }).closePromise.then(needUpdate => {
\r
121 updateContactUsTable();
\r
125 this.goToSection = (id) => {
\r
127 var targetDiv = document.getElementById(id);
\r
129 var offSetHeight = 0;
\r
130 for(var i=0;i<this.appTable.length;i++){
\r
131 if(this.appTable[i].app_Id==id)
\r
133 if(this.appTable[i].showFlag==true){
\r
134 offSetHeight+=document.getElementById('collapse'+i).clientHeight;
\r
137 console.log(offSetHeight);
\r
138 this.appTable.forEach(d => d.showFlag = false);
\r
139 // let index = this.appTable.findIndex(a => a.app_Id == id);
\r
141 for(var i=0; i<this.appTable.length;i++){
\r
142 if(this.appTable[i].app_Id==id){
\r
147 console.log(index);
\r
149 // setting the showFlag to true based on index comparing with the app_Id
\r
150 this.appTable[index].showFlag = true;
\r
151 $location.hash('appId'+index);
\r
153 /* $('#contentId').animate({
\r
154 scrollTop: targetDiv.offsetTop-offSetHeight
\r
160 // Take the user to the application on the get access page.
\r
161 this.goGetAccess = (appName) => {
\r
162 // $log.debug('ContactUsCtrl::goGetAccess received name ' + appName);
\r
163 applicationsService.goGetAccessAppName = appName;
\r
164 $state.go('root.getAccess');
\r
169 ContactUsCtrl.$inject = ['$log','contactUsService', 'applicationsService', '$modal', 'ngDialog', '$state','$anchorScroll','$location'];
\r
170 angular.module('ecompApp').controller('ContactUsCtrl', ContactUsCtrl);
\r