diff options
Diffstat (limited to 'portal-FE-common/src/app/pages/contact-us/contact-us-manage')
4 files changed, 480 insertions, 0 deletions
diff --git a/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.html b/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.html new file mode 100644 index 00000000..0d710f98 --- /dev/null +++ b/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.html @@ -0,0 +1,156 @@ +<!-- + ============LICENSE_START========================================== + ONAP Portal + =================================================================== + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + =================================================================== + + Unless otherwise specified, all software contained herein is licensed + under the Apache License, Version 2.0 (the "License"); + you may not use this software except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Unless otherwise specified, all documentation contained herein is licensed + under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + you may not use this documentation except in compliance with the License. + You may obtain a copy of the License at + + https://creativecommons.org/licenses/by/4.0/ + + Unless required by applicable law or agreed to in writing, documentation + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ============LICENSE_END============================================ + + + --> +<div class="container"> + <!--Modal Headers--> + <div class="modal-header"> + <h4 class="modal-title">Manage Contact Us</h4> + <button type="button" class="close" aria-label="Close" (click)="activeModal.dismiss('Cross')"> + <span aria-hidden="true">×</span> + </button> + </div> + + <!--Modal Body goes here--> + <div class="modal-body"> + <div class="c-ecomp-portal-abs-table contactus-manage-table"> + <table b2b-table id="table-main" table-data="contactUsList" current-page="ignoredCurrentPage"> + <thead b2b-table-row type="header"> + <tr> + <th id="th-users-0" b2b-table-header key="ecomp_function" default-sort="a">App Name</th> + <th id="th-users-1" b2b-table-header key="app_name" sortable="true">Contact Name</th> + <th id="th-users-2" b2b-table-header key="app_name" sortable="true">Contact Email</th> + <th id="th-users-3" b2b-table-header key="role_name" sortable="true">Contact URL</th> + <th id="th-users-4" b2b-table-header key="role_name" sortable="true">Description</th> + <th id="th-users-5" b2b-table-header key="role_name" sortable="true">Edit</th> + <th id="th-users-6" b2b-table-header key="role_name" sortable="true">Delete</th> + </tr> + </thead> + <!-- Use track-by="UNIQUE KEY HERE" or leave out if no unique keys in data --> + <tbody b2b-table-row type="body" class="table-body" track-by="$index" *ngFor="let rowData of contactUsList; index as i"> + <tr id="tr-rowData" ng-click=""> + <td b2b-table-body> + <div id="users-page-td-appName" [innerHtml]="rowData.appName"></div> + </td> + <td b2b-table-body> + <div id="users-page-td-name" [hidden]="showEdit" [innerHtml]="rowData.contactName"></div> + <input class="input-inline-edit-text" type="text" *ngIf="showEdit" [(ngModel)]="rowData.contactName" /> + </td> + <td b2b-table-body> + <div id="users-page-td-email" [hidden]="showEdit" [innerHtml]="rowData.contactEmail"></div> + <input class="input-inline-edit-text" type="text" *ngIf="showEdit" [(ngModel)]="rowData.contactEmail" /> + </td> + <td b2b-table-body> + <div id="users-page-td-url" [hidden]="showEdit" [innerHtml]="rowData.url"></div> + <input class="input-inline-edit-text" type="text" *ngIf="showEdit" [(ngModel)]="rowData.url" /> + </td> + <td b2b-table-body> + <div id="users-page-td-descr" [hidden]="showEdit" [innerHtml]=" rowData.description"></div> + <input class="input-inline-edit-text" type="text" *ngIf="showEdit" [(ngModel)]="rowData.description" /> + </td> + <td b2b-table-body> + <div class="edit-contact-us" [hidden]="showEdit"> + <span class="icon-edit" (click)="showEdit=true"> + <i class="icon ion-md-create"></i> + </span> + </div> + <span *ngIf="showEdit" (click)="editContactUs(rowData)"> + <i class="icon ion-md-save"></i> + </span> + </td> + <td b2b-table-body> + <div class="delete-contact-us"> + <span class="icon-trash" (click)="delContactUs(rowData)"> + <i class="icon ion-md-trash"></i> + </span> + </div> + </td> + </tr> + </tbody> + </table> + </div> + + <div class="divider-line"></div> + + <div class="contactus-addWidgetHeader"> + <div id="addWidgetHeader" class="contact-us-margin"> + <p class="edit-contactus-title">Add Application Contact Information</p> + </div> + <div id="addWidget" class="contact-us-margin"> + <div> + <form name="contactForm" novalidate autocomplete="off"> + <div id="add-contact-us-field-appname" class="add-contact-us-field"> + <mat-form-field class="contact-us-applications-select"> + <mat-label> <span id="required" class="mots-property-label-spn" visible="false"> *</span>Application Name </mat-label> + <mat-select name="contact-us-applications-select" id="application" + name="applicationName" [(ngModel)]="selectedApp" [(value)]="selected"> + <mat-option *ngFor="let d of contactUsAllAppList" [value]="d" >{{d.title}}</mat-option> + </mat-select> + </mat-form-field> + <div id="mots-property-label-required" *ngIf="selectedApp==null || selectedApp==''"> + <small class="mandatory-categories">App Name is Required</small> + </div> + </div> + <br> + <div class="addApplicationContactInfo"> + <div id="add-contact-us-field-contactname" class="add-contact-us-field"> + <div id="property-label-name" class="property-label">Contact Name</div> + <input id="property-input-name" name="name" class="input-text-area" type="text" [(ngModel)]="newContactUs.contactName" /> + </div> + <div id="add-contact-us-field-email" class="add-contact-us-field"> + <div id="property-label-email" class="property-label">Contact Email</div> + <input id="property-input-email" name="email" class="input-text-area" type="text" [(ngModel)]="newContactUs.contactEmail" /> + </div> + <div id="add-contact-us-field-url" class="add-contact-us-field"> + <div id="property-label-url" class="property-label">Contact URL</div> + <input id="property-input-url" name="url" class="input-text-area" type="text" [(ngModel)]="newContactUs.url" /> + </div> + </div> + <div id="add-contact-us-field-desc" class="add-contact-us-field-des"> + <div id="property-label-desc" class="property-label">Description</div> + <textarea id="property-input-desc" name="description" class="property-label-desc-txtarea" [(ngModel)]="newContactUs.description"></textarea> + </div> + </form> + </div> + </div> + </div> + </div> + <!--Modal Footer goes Here--> + <div class="modal-footer"> + <button type="button" class="btn btn-primary" (click)="activeModal.close('Close')">Close</button> + <button type="button" class="btn btn-primary" (click)="addNewContactUs()">Add New</button> + </div> +</div>
\ No newline at end of file diff --git a/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.scss b/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.scss new file mode 100644 index 00000000..bff240e2 --- /dev/null +++ b/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.scss @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + ::ng-deep .modal-dialog { + max-width: 1200px; + width: 1200px; + overflow-x: auto; + overflow-y: auto; +} + +.addApplicationContactInfo{ + display: inline-flex; +} + +.addApplicationContactInfo input[type="text"] { + width: 22em; + margin-right: 8px; +} + +.property-label-desc-txtarea { + overflow: auto; + resize: vertical; + width: 67em; +} + +.divider-line{ + border-bottom-style: solid; + border-bottom-width: 1px; + padding-bottom: 50px; +} + +.edit-contactus-title { + margin-top: 28px; + margin-bottom: 1rem; + font-size: 23px; +} + +.required:before { + color: #cf2a2a; + margin-right: 2px; + content: "* "; + position: absolute; + top: 45px; + left: 28px; +} diff --git a/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.spec.ts b/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.spec.ts new file mode 100644 index 00000000..06b6995a --- /dev/null +++ b/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.spec.ts @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ContactUsManageComponent } from './contact-us-manage.component'; + +describe('ContactUsManageComponent', () => { + let component: ContactUsManageComponent; + let fixture: ComponentFixture<ContactUsManageComponent>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ContactUsManageComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ContactUsManageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.ts b/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.ts new file mode 100644 index 00000000..e04ccb77 --- /dev/null +++ b/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.ts @@ -0,0 +1,182 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +import { Component, OnInit, Input} from '@angular/core'; +import { ContactUsService } from '../../../shared/services/index'; +import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap'; + +@Component({ + selector: 'app-contact-us-manage', + templateUrl: './contact-us-manage.component.html', + styleUrls: ['./contact-us-manage.component.scss'] +}) +export class ContactUsManageComponent implements OnInit { + + contactUsList = []; + contactUsAllAppList = []; + result: any; + selectedApp: any; + showEdit: boolean = false; + newContactUs ={ + appId:'', + appName:'', + description:'', + contactName:'', + contactEmail:'', + url:'' , + activeYN:'' + }; + + + constructor(public activeModal: NgbActiveModal, public ngbModal: NgbModal, public contactUsService: ContactUsService) { } + + ngOnInit() { + + this.getContactUsList(); + this.getListOfApp(); + } + + getContactUsList(){ + console.log("getContactUsList called..."); + this.contactUsService.getContactUs() + .subscribe( _data => { + this.result = _data; + console.log("getContactUsList Data :: ", _data); + if (this.result.response == null || this.result.response == 'undefined') { + console.log('ContactUsService::getContactUsList Failed: Result or result.data is null'); + }else{ + for(var i=0; i<this.result.response.length;i++){ + if(this.result.response[i].appId!=1) + this.contactUsList.push(this.result.response[i]); + } + } + },error =>{ + console.log(error); + }); + } + + getListOfApp(){ + console.log("getListOfApp called..."); + this.contactUsService.getListOfApp() + .subscribe( _data => { + this.result = _data; + console.log("getListOfApp Data :: ", _data); + if (this.result == null || this.result == 'undefined') { + console.log('ContactUsService::getListOfApp Failed: Result or result.data is null'); + }else{ + let res1 = this.result; + let realAppIndex = 0; + this.contactUsAllAppList.length=0; + console.log("this.contactUsList ",this.contactUsList) + for (var i = 1; i <= res1.length; i++) { + if (!res1[i - 1].restrictedApp) { + var okToAdd = true; + for(var j =0; j<this.contactUsList.length;j++){ + if(res1[i - 1].title == this.contactUsList[j].appName){ + okToAdd=false; + console.log("okToAdd=false res1[i - 1].title ",res1[i - 1].title); + } + } + // not allowed to add(duplicate) another entry if the app is already available in the table + if(okToAdd){ + if(res1[i - 1].title){ + this.contactUsAllAppList.push({ + index: realAppIndex, + title: res1[i - 1].title, + value: res1[i - 1].index + }); + } + realAppIndex = realAppIndex + 1; + } + } + } + } + },error =>{ + console.log(error); + }); + } + + addNewContactUs(){ + console.log("Calling addNewContactUs"); + let selectedApplication = this.selectedApp; + this.newContactUs.appId = selectedApplication.value; + this.newContactUs.appName = selectedApplication.title; + console.log("newContactUsObj ",this.newContactUs); + this.contactUsService.addContactUs(this.newContactUs) + .subscribe( _data => { + this.result = _data; + console.log("addContactUs response :: ", _data); + this.contactUsList.push(this.newContactUs); + },error =>{ + console.log(error); + }); + } + + editContactUs(contactObj: any){ + + var contactUsObj={ + appId:contactObj.appId, + appName:contactObj.appName, + description:contactObj.description, + contactName:contactObj.contactName, + contactEmail:contactObj.contactEmail, + url:contactObj.url, + }; + + this.contactUsService.modifyContactUs(contactUsObj) + .subscribe( _data => { + this.result = _data; + console.log("editContactUsFun response :: ", _data); + this.showEdit=false; + },error =>{ + console.log(error); + }); + } + + delContactUs(appObj: any){ + this.contactUsService.removeContactUs(appObj.appId) + .subscribe( _data => { + this.result = _data; + console.log("delContactUsFun response :: ", _data); + this.contactUsList.splice(appObj, 1); + },error =>{ + console.log(error); + }); + } + +} |