2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
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 * ================================================================================
25 constructor($log, contactUsService, applicationsService, $modal, ngDialog, $state) {
27 contactUsService.getContactUSPortalDetails().then(res => {
28 // $log.info('ContactUsCtrl:: contactUsService getContactUSPortalDetails res',res);
29 // $log.info('getting res',res);
30 var result = (typeof(res.response) != "undefined" && res.response!=null)?res.response:null;
31 // $log.info('result',result);
33 var source = JSON.parse(result);
35 this.ush_TicketInfoUrl = source.ush_ticket_url;
36 this.portalInfo_Address = source.feedback_email_address;
37 this.feedback_Url = source.portal_info_url;
39 $log.error('ContactUsCtrl:error:: ', err);
44 // $log.info('ecomp app::contact-us-controller::initializing...');
46 this.functionalTableData=[];
50 let updateContactUsTable = () => {
51 contactUsService.getAppsAndContacts().then(res=> {
52 // $log.info('ContactUsCtrl:: contactUsService getAppsAndContacts res',res);
54 // $log.info('getting res',res);
55 var result = (typeof(res.response) != "undefined" && res.response!=null)?res.response:null;
56 // $log.info('result',result);
60 // Drop Portal app, empty name entries
61 for(var i=0;i<source.length; i++) {
62 var dataArr = source[i];
63 if ( !dataArr.appName || dataArr.appId == 1) {
67 app_name: dataArr.appName,
68 contact_name: dataArr.contactName,
69 contact_email: dataArr.contactEmail,
70 desc: dataArr.description,
71 url_Info: dataArr.url,
72 app_Id: dataArr.appId,
74 tableData.push(dataTemp);
76 this.appTable=tableData;
78 $log.error('ContactUsCtrl.updateContactUsTable:error:: ', err);
82 contactUsService.getAppCategoryFunctions().then(res=> {
83 // $log.info('ContactUsCtrl:: contactUsService getAppCategoryFunctionsthen res',res);
84 var tablefunctionalData=[];
85 // $log.info('getting res',res);
86 var result = (typeof(res.response) != "undefined" && res.response!=null)?res.response:null;
87 // $log.info('result',result);
91 for(var i=0;i<source.length; i++) {
92 var datafunctionalArr = source[i];
93 var datafuntionalTemp={
94 category: datafunctionalArr.category,
95 app_Name: datafunctionalArr.application,
96 functions: datafunctionalArr.functions,
97 app_Id: datafunctionalArr.appId,
99 tablefunctionalData.push(datafuntionalTemp);
101 this.functionalTableData=tablefunctionalData;
103 $log.error('ContactUsCtrl:error:: ', err);
106 updateContactUsTable();
107 this.editContactUsModalPopup = () => {
108 // $log.debug('ContactUsCtrl::editContactUsModalPopup updating table data...');
109 var modalInstance = ngDialog.open({
110 templateUrl: 'app/views/support/contact-us/contact-us-manage/contact-us-manage.html',
111 controller: 'ContactUsManageController',
113 message: function message() {
120 }).closePromise.then(needUpdate => {
121 updateContactUsTable();
125 this.goToSection = (id) => {
126 var targetDiv = document.getElementById(id);
127 var offSetHeight = 0;
128 for(var i=0;i<this.appTable.length;i++){
129 if(this.appTable[i].app_Id==id)
131 if(this.appTable[i].showFlag==true){
132 offSetHeight+=document.getElementById('collapse'+i).clientHeight;
135 this.appTable.forEach(d => d.showFlag = false);
136 // let index = this.appTable.findIndex(a => a.app_Id == id);
138 for(var i=0; i<this.appTable.length;i++){
139 if(this.appTable[i].app_Id==id){
146 // setting the showFlag to true based on index comparing with the app_Id
147 this.appTable[index].showFlag = true;
148 $('#contentId').animate({
149 scrollTop: targetDiv.offsetTop-offSetHeight + 'px'
155 // Take the user to the application on the get access page.
156 this.goGetAccess = (appName) => {
157 // $log.debug('ContactUsCtrl::goGetAccess received name ' + appName);
158 applicationsService.goGetAccessAppName = appName;
159 $state.go('root.getAccess');
164 ContactUsCtrl.$inject = ['$log','contactUsService', 'applicationsService', '$modal', 'ngDialog', '$state'];
165 angular.module('ecompApp').controller('ContactUsCtrl', ContactUsCtrl);