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,$anchorScroll,$location) {
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 var modalInstance = $modal.open({
109 templateUrl: 'app/views/support/contact-us/contact-us-manage/contact-us-manage.html',
110 controller: 'ContactUsManageController',
111 windowClass: 'modal-docked',
113 message: function message() {
122 modalInstance.result.finally(function (needUpdate) {
123 updateContactUsTable();
128 this.goToSection = (id) => {
130 var targetDiv = document.getElementById(id);
132 var offSetHeight = 0;
133 for(var i=0;i<this.appTable.length;i++){
134 if(this.appTable[i].app_Id==id)
136 if(this.appTable[i].showFlag==true){
137 offSetHeight+=document.getElementById('collapse'+i).clientHeight;
140 console.log(offSetHeight);
141 this.appTable.forEach(d => d.showFlag = false);
142 // let index = this.appTable.findIndex(a => a.app_Id == id);
144 for(var i=0; i<this.appTable.length;i++){
145 if(this.appTable[i].app_Id==id){
152 // setting the showFlag to true based on index comparing with the app_Id
153 this.appTable[index].showFlag = true;
154 $location.hash('appId'+index);
156 /* $('#contentId').animate({
157 scrollTop: targetDiv.offsetTop-offSetHeight
163 // Take the user to the application on the get access page.
164 this.goGetAccess = (appName) => {
165 // $log.debug('ContactUsCtrl::goGetAccess received name ' + appName);
166 applicationsService.goGetAccessAppName = appName;
167 $state.go('root.getAccess');
172 ContactUsCtrl.$inject = ['$log','contactUsService', 'applicationsService', '$modal', 'ngDialog', '$state','$anchorScroll','$location'];
173 angular.module('ecompApp').controller('ContactUsCtrl', ContactUsCtrl);