2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2019 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============================================
39 import { Component, OnInit, ViewChild, Input } from '@angular/core';
40 import { MatTableDataSource } from '@angular/material';
41 import { MatSort, MatPaginator } from '@angular/material';
42 import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
43 import { ContactUsService } from '../../shared/services/index';
44 import { ContactUsManageComponent } from './contact-us-manage/contact-us-manage.component';
47 selector: 'app-contact-us',
48 templateUrl: './contact-us.component.html',
49 styleUrls: ['./contact-us.component.scss']
51 export class ContactUsComponent implements OnInit {
53 contactUsList: Array<Object> = [];
54 appTable: Array<Object> = [];
55 functionalTableData: Array<Object> = [];
57 ush_TicketInfoUrl: string;
58 portalInfo_Address: string;
60 showUp: boolean = true;
61 showDown: boolean = false;
64 isEditMode: boolean = false;
65 displayedColumns: string[] = ['category', 'eCOMPFunctions','eCOMPApplications'];
66 dataSource = new MatTableDataSource(this.functionalTableData);
67 @ViewChild(MatSort) sort: MatSort;
68 @ViewChild(MatPaginator) paginator: MatPaginator;
70 constructor(public contactUsService: ContactUsService, public ngbModal: NgbModal) { }
74 this.functionalTableData=[];
76 this.getContactUSPortalDetails();
77 this.updateContactUsTable();
78 this.getAppCategoryFunctions()
81 getContactUSPortalDetails(){
82 console.log("getContactUSPortalDetails called...");
83 this.contactUsService.getContactUSPortalDetails()
84 .subscribe( _data => {
86 console.log("getContactUSPortalDetails Data :: ", _data);
87 if (this.result.response == null || this.result.response == 'undefined') {
88 console.log('ContactUsService::getContactUSPortalDetails Failed: Result or result.data is null');
90 var source = JSON.parse(this.result.response);
91 this.ush_TicketInfoUrl = source.ush_ticket_url;
92 this.portalInfo_Address = source.feedback_email_address;
93 this.feedback_Url = source.portal_info_url;
100 updateContactUsTable(){
101 console.log("updateContactUsTable called...");
102 this.contactUsService.getAppsAndContacts()
103 .subscribe( _data => {
105 console.log("getAppsAndContacts Data :: ", _data);
106 if (this.result.response == null || this.result.response == 'undefined') {
107 console.log('ContactUsService::getAppsAndContacts Failed: Result or result.data is null');
110 var source = this.result.response;
111 for(var i=0; i<source.length; i++) {
112 var dataArr = source[i];
113 if ( !dataArr.appName || dataArr.appId == 1) {
118 app_name: dataArr.appName,
119 contact_name: dataArr.contactName,
120 contact_email: dataArr.contactEmail,
121 desc: dataArr.description,
122 url_Info: dataArr.url,
123 app_Id: dataArr.appId,
126 tableData.push(dataTemp);
129 this.appTable=tableData;
136 getAppCategoryFunctions(){
137 console.log("getAppCategoryFunctions called");
138 this.contactUsService.getAppCategoryFunctions()
139 .subscribe( _data => {
141 console.log("getAppCategoryFunctions Data :: ", _data);
142 if (this.result.response == null || this.result.response == 'undefined') {
143 console.log('ContactUsService::getAppCategoryFunctions Failed: Result or result.data is null');
145 var tablefunctionalData=[];
146 var source = this.result.response;
147 for(var i=0;i<source.length; i++) {
148 var datafunctionalArr = source[i];
149 var datafuntionalTemp={
150 category: datafunctionalArr.category,
151 app_Name: datafunctionalArr.application,
152 functions: datafunctionalArr.functions,
153 app_Id: datafunctionalArr.appId,
155 tablefunctionalData.push(datafuntionalTemp);
157 this.functionalTableData = tablefunctionalData;
158 this.populateTableData(this.functionalTableData);
165 populateTableData(functionalTableData: Array<Object>){
166 this.dataSource = new MatTableDataSource(functionalTableData);
167 this.dataSource.sort = this.sort;
168 this.dataSource.paginator = this.paginator;
171 editContactUsModal() {
172 const modalRef = this.ngbModal.open(ContactUsManageComponent, { size: 'lg' });
175 showApplicationInfo(appId: any){
176 console.log("AppId Contact US...",appId);
177 let appInfoDiv = document.getElementById('collapse'+appId);
178 let uparrowDiv = document.getElementById('arrowup'+appId);
179 let downarrowDiv = document.getElementById('arrowdown'+appId);
181 if(!appInfoDiv.getAttribute('hidden')){
182 appInfoDiv.setAttribute("hidden","true");
183 uparrowDiv.setAttribute("hidden", "true");
184 downarrowDiv.removeAttribute("hidden");
185 }else if(appInfoDiv.getAttribute('hidden')){
186 appInfoDiv.removeAttribute("hidden");
187 uparrowDiv.removeAttribute("hidden");
188 downarrowDiv.setAttribute("hidden","true");
192 goGetAccess(app_name: any){
193 console.log("Get Access :: goGetAccess method implemetation is pending... appName : ",app_name);