2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
8 * Unless otherwise specified, all software contained herein is licensed
9 * under the Apache License, Version 2.0 (the "License");
10 * you may not use this software except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * Unless otherwise specified, all documentation contained herein is licensed
22 * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23 * you may not use this documentation except in compliance with the License.
24 * You may obtain a copy of the License at
26 * https://creativecommons.org/licenses/by/4.0/
28 * Unless required by applicable law or agreed to in writing, documentation
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
34 * ============LICENSE_END============================================
43 constructor($log, contactUsService, applicationsService, $modal, ngDialog, $state,$anchorScroll,$location) {
45 contactUsService.getContactUSPortalDetails().then(res => {
46 // $log.info('ContactUsCtrl:: contactUsService getContactUSPortalDetails res',res);
47 // $log.info('getting res',res);
48 var result = (typeof(res.response) != "undefined" && res.response!=null)?res.response:null;
49 // $log.info('result',result);
51 var source = JSON.parse(result);
53 this.ush_TicketInfoUrl = source.ush_ticket_url;
54 this.portalInfo_Address = source.feedback_email_address;
55 this.feedback_Url = source.portal_info_url;
57 $log.error('ContactUsCtrl:error:: ', err);
62 // $log.info('ecomp app::contact-us-controller::initializing...');
64 this.functionalTableData=[];
68 let updateContactUsTable = () => {
69 contactUsService.getAppsAndContacts().then(res=> {
70 // $log.info('ContactUsCtrl:: contactUsService getAppsAndContacts res',res);
72 // $log.info('getting res',res);
73 var result = (typeof(res.response) != "undefined" && res.response!=null)?res.response:null;
74 // $log.info('result',result);
78 // Drop Portal app, empty name entries
79 for(var i=0;i<source.length; i++) {
80 var dataArr = source[i];
81 if ( !dataArr.appName || dataArr.appId == 1) {
85 app_name: dataArr.appName,
86 contact_name: dataArr.contactName,
87 contact_email: dataArr.contactEmail,
88 desc: dataArr.description,
89 url_Info: dataArr.url,
90 app_Id: dataArr.appId,
92 tableData.push(dataTemp);
94 this.appTable=tableData;
96 $log.error('ContactUsCtrl.updateContactUsTable:error:: ', err);
100 contactUsService.getAppCategoryFunctions().then(res=> {
101 // $log.info('ContactUsCtrl:: contactUsService getAppCategoryFunctionsthen res',res);
102 var tablefunctionalData=[];
103 // $log.info('getting res',res);
104 var result = (typeof(res.response) != "undefined" && res.response!=null)?res.response:null;
105 // $log.info('result',result);
106 // $log.info('done');
108 // $log.info(source);
109 for(var i=0;i<source.length; i++) {
110 var datafunctionalArr = source[i];
111 var datafuntionalTemp={
112 category: datafunctionalArr.category,
113 app_Name: datafunctionalArr.application,
114 functions: datafunctionalArr.functions,
115 app_Id: datafunctionalArr.appId,
117 tablefunctionalData.push(datafuntionalTemp);
119 this.functionalTableData=tablefunctionalData;
121 $log.error('ContactUsCtrl:error:: ', err);
124 updateContactUsTable();
125 this.editContactUsModalPopup = () => {
126 var modalInstance = $modal.open({
127 templateUrl: 'app/views/support/contact-us/contact-us-manage/contact-us-manage.html',
128 controller: 'ContactUsManageController',
129 windowClass: 'modal-docked',
131 message: function message() {
140 modalInstance.result.finally(function (needUpdate) {
141 updateContactUsTable();
146 this.goToSection = (id) => {
148 var targetDiv = document.getElementById(id);
150 var offSetHeight = 0;
151 for(var i=0;i<this.appTable.length;i++){
152 if(this.appTable[i].app_Id==id)
154 if(this.appTable[i].showFlag==true){
155 offSetHeight+=document.getElementById('collapse'+i).clientHeight;
158 console.log(offSetHeight);
159 this.appTable.forEach(d => d.showFlag = false);
160 // let index = this.appTable.findIndex(a => a.app_Id == id);
162 for(var i=0; i<this.appTable.length;i++){
163 if(this.appTable[i].app_Id==id){
170 // setting the showFlag to true based on index comparing with the app_Id
171 this.appTable[index].showFlag = true;
172 $location.hash('appId'+index);
174 /* $('#contentId').animate({
175 scrollTop: targetDiv.offsetTop-offSetHeight
181 // Take the user to the application on the get access page.
182 this.goGetAccess = (appName) => {
183 // $log.debug('ContactUsCtrl::goGetAccess received name ' + appName);
184 applicationsService.goGetAccessAppName = appName;
185 $state.go('root.getAccess');
190 ContactUsCtrl.$inject = ['$log','contactUsService', 'applicationsService', '$modal', 'ngDialog', '$state','$anchorScroll','$location'];
191 angular.module('ecompApp').controller('ContactUsCtrl', ContactUsCtrl);