summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-FE-common/client/app/views/support/contact-us/contact-us-manage
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-portal-FE-common/client/app/views/support/contact-us/contact-us-manage')
-rw-r--r--ecomp-portal-FE-common/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.controller.js202
-rw-r--r--ecomp-portal-FE-common/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.controller.less152
-rw-r--r--ecomp-portal-FE-common/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.html180
3 files changed, 534 insertions, 0 deletions
diff --git a/ecomp-portal-FE-common/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.controller.js b/ecomp-portal-FE-common/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.controller.js
new file mode 100644
index 00000000..8413382e
--- /dev/null
+++ b/ecomp-portal-FE-common/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.controller.js
@@ -0,0 +1,202 @@
+/*-
+ * ================================================================================
+ * ECOMP Portal
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+'use strict';
+
+(function () {
+ class ContactUsManageController {
+ constructor($scope,$log, message, $q, $http, conf,contactUsService,confirmBoxService) {
+ $scope.contactUsList=[];
+ $scope.contactUsAllAppList=[];
+ $scope.errMsg='';
+ $scope.newContactUs ={
+ app:'',
+ name:'',
+ email:'',
+ url:'',
+ desc:''
+ };
+ /*Get the existing contact us first, then based on the existing, filter from all apps*/
+ $scope.getContactUsList = function(){
+ contactUsService.getContactUs().then(res=> {
+ // $log.info('getting getContactUs',res.response);
+ if(res!=null && res.response!=null){
+ for(var i=0; i<res.response.length;i++){
+ if(res.response[i].appId!=1)
+ $scope.contactUsList.push(res.response[i]);
+ }
+ }
+ /*get all the apps*/
+ contactUsService.getListOfApp().then(res=> {
+ var tableData=[];
+ $scope.contactUsAllAppListTemp=[];
+ // $log.info('contactUsService::getListOfApp: getting res');
+ var result = (typeof(res.data) != "undefined" && res.data!=null)?res.data:null;
+ // $log.info('contactUsService::getListOfApp: result',result);
+ var res1 = result;
+ var realAppIndex = 0;
+ $scope.contactUsAllAppList.length=0;
+ for (var i = 1; i <= res1.length; i++) {
+ if (!res1[i - 1].restrictedApp) {
+ var okToAdd = true;
+ for(var j =0; j<$scope.contactUsList.length;j++){
+ if(res1[i - 1].title==$scope.contactUsList[j].appName)
+ okToAdd=false;
+ }
+ // not allowed to add(duplicate) another entry if the app is already available in the table
+ if(okToAdd){
+ if(res1[i - 1].title){
+ $scope.contactUsAllAppList.push({
+ index: realAppIndex,
+ title: res1[i - 1].title,
+ value: res1[i - 1].index
+ });
+ }
+ realAppIndex = realAppIndex + 1;
+ }
+ } else {
+ // $log.debug('contactUsService:getAvailableApps:: Restricted/URL only App will not be used = ' + res1[i - 1].title);
+ }
+ }
+ }).catch(err=> {
+ $log.error('contactUsService:error:: ', err);
+
+
+ }).finally(() => {
+ //this.isLoadingTable = false;
+ });
+ });
+ }
+
+ $scope.getContactUsList();
+
+ $scope.closeDialog = function(){
+ $scope.closeThisDialog( $scope.widgetData);
+ }
+
+ /*Add new Contact Us*/
+ $scope.newContactUsFun = function(){
+ if($scope.newContactUs.app.title==null || $scope.newContactUs.app.title=='' ){
+ confirmBoxService.showInformation('Please select an App to add').then(isConfirmed => {
+ return;
+ });
+ }
+
+ if($scope.newContactUs.url !=null && $scope.newContactUs.url != '' && !validateUrl($scope.newContactUs.url)){
+ var warningMsg = "Please enter a valid URL";
+ confirmBoxService.showInformation(warningMsg).then(isConfirmed => {return;});
+ return;
+ }
+
+ contactUsService.addContactUs($scope.newContactUs).then(res=> {
+ // $log.info('contactUsService: add ContactUs successfully');
+ $scope.contactUsList.length=0;
+ // $log.info('contactUsService: refreshing the Contact US table');
+ $scope.getContactUsList();
+ $scope.errMsg='';
+ /* confirmBoxService.showInformation('You have added a new Contact Us item').then(isConfirmed => { });*/
+ var defaultSel={
+ index: 0,
+ title: '',
+ value: ''
+ }
+ $scope.newContactUs ={
+ app:defaultSel,
+ name:'',
+ email:'',
+ url:'',
+ desc:''
+ };
+
+ }).catch(err=> {
+ $log.error('contactUsService: addContactUs error:: ', err);
+ // $scope.errMsg=err;
+ confirmBoxService.showInformation('Add Contact Us list failed: ' + err);
+
+ }).finally(() => {
+ //this.isLoadingTable = false;
+ });
+ }
+ /* Edit Contact Us*/
+ $scope.editContactUsFun = function(contactObj){
+ // $log.info('contactUsService: edit ContactUs save successfully', contactObj);
+ var contactUsObj={
+ appId:contactObj.appId,
+ appName:contactObj.appName,
+ description:contactObj.description,
+ contactName:contactObj.contactName,
+ contactEmail:contactObj.contactEmail,
+ url:contactObj.url,
+ };
+
+ contactUsService.modifyContactUs(contactUsObj).then(res=> {
+ // $log.info('contactUsService: edit ContactUs successfully');
+ // confirmBoxService.showInformation('You have saved the changes').then(isConfirmed => {});
+ $scope.errMsg='';
+
+ }).catch(err=> {
+ $log.error('contactUsService: editContactUs error:: ', err);
+ confirmBoxService.showInformation('Edit Contact Us list failed: ' + err);
+ // $scope.errMsg=err;
+ }).finally(() => {
+ //this.isLoadingTable = false;
+ });
+
+ }
+
+ $scope.$watch('newContactUs.app.value', (newVal, oldVal) => {
+ for(var i=0;i<$scope.contactUsAllAppList.length;i++){
+ if($scope.contactUsAllAppList[i].value==newVal){
+ $scope.newContactUs.app=angular.copy($scope.contactUsAllAppList[i]);;
+ }
+ }
+ });
+ /*del Contact Us*/
+ $scope.delContactUsFun = function(appObj){
+ var confirmMsg = 'Are you sure you want to delete '+appObj.appName +' from the list?' + ' Press OK to delete.';
+ confirmBoxService.confirm(confirmMsg).then(function (confirmed) {
+ if (confirmed == true) {
+ contactUsService.removeContactUs(appObj.appId).then(res=> {
+ // $log.info('delContactUsFun: delete ContactUs successfully',res);
+ $scope.errMsg='';
+ $scope.contactUsList.length=0;
+ $scope.getContactUsList();
+ confirmBoxService.showInformation('Item has been deleted').then(isConfirmed => {});
+ }).catch(err=> {
+ $log.error('contactUsService: addContactUs error:: ', err);
+ confirmBoxService.showInformation('Deletion failed: ' + err);
+ // $scope.errMsg=err;
+ }).finally(() => {
+ //this.isLoadingTable = false;
+ });
+ }
+ });
+
+ }
+
+ }
+ }
+ ContactUsManageController.$inject = ['$scope','$log', 'message', '$q', '$http', 'conf','contactUsService','confirmBoxService'];
+ angular.module('ecompApp').controller('ContactUsManageController', ContactUsManageController);
+
+
+})();
+function validateUrl(value){
+ return /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
+ }
diff --git a/ecomp-portal-FE-common/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.controller.less b/ecomp-portal-FE-common/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.controller.less
new file mode 100644
index 00000000..905f9faa
--- /dev/null
+++ b/ecomp-portal-FE-common/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.controller.less
@@ -0,0 +1,152 @@
+.searchLiHeader {
+font-weight: bold;
+color: #0574ac;
+font-size: 16px;
+padding-bottom: 10px;
+line-height: 1.5;
+font-family: Omnes-ECOMP-W02,Arial;
+
+}
+
+.searchLiItems{
+cursor: pointer;
+font-weight: normal;
+font-size: 12px;
+color: #444444;
+font-family: Omnes-ECOMP-W02,Arial;
+}
+
+.searchUl {
+list-style: none;
+border-bottom: 1px solid #bbb;
+padding-bottom: 20px;
+}
+
+.manage-contactUs-home-title{
+ color: #067ab4;
+ font-family: "Omnes-ECOMP-W02", Arial;;
+ font-size: 24px;
+ margin-left: 78px;
+ width: 1170px;
+ }
+
+.manage-contactUs-home-manageWidgets-title{
+ color: #067ab4;
+ font-family: "Omnes-ECOMP-W02", Arial;;
+ font-size: 24px;
+ margin-left: 30px;
+ width: 1170px;
+ }
+
+#editWidgetsContent {
+ height: 300px;
+ width: 1250px;
+ }
+
+#editWidgetsContent .scroll-viewport {
+ height: 300px;
+ width: 1250px;
+ }
+
+ .add-contact-us-field{
+ width:250px;
+ display: inline-block;
+ margin:10px;
+ }
+ .add-contact-us-field-des{
+ width:800px;
+ margin:10px;
+ }
+
+.errMsg{
+ color:red;
+}
+.sucessMsg{
+ color:green;
+}
+.contact-us-margin{
+ margin-left: 80px;
+ margin-right: 120px;
+}
+.contact-us-manage-table {
+
+
+ .delete-contact-us{
+ font-size:20px;
+ }
+
+ .portal-add-button {
+ width: 160px;
+ }
+}
+
+.select2-container .select2-chosen, .select2-container .select2-container input{
+ line-height:32px;
+}
+.select2-container .select2-choice{
+ -webkit-transition: border-color .2s ease-out;
+ -moz-transition: border-color .2s ease-out;
+ transition: border-color .2s ease-out;
+ background: #fff;
+ border-radius: 6px;
+ display: block;
+ border: 1px solid #888;
+ box-shadow: none;
+ filter: none;
+ height: 32px !important;
+ padding: 0;
+ position: relative;
+ z-index: 5;
+ cursor: pointer;
+}
+
+.c-ecomp-portal-abs-table .contactUs{
+
+ height:300px;
+
+}
+
+.c-ecomp-portal-abs-table
+{
+background-color: transparent;
+}
+.ngdialog-overlay {
+ pointer-events: none !important;
+}
+
+.input-text-area {
+ font-style: italic;
+ padding: 7px 10px;
+ width: 250px;
+ display: inline-block;
+ position: relative;
+ margin-bottom: 10px;
+ border-radius: 6px;
+ border: 1px solid #d8d8d8;
+ height: 32px !important;
+ border-color: slategrey !important;
+}
+.input-inline-edit-text {
+ font-style: italic;
+ padding: 7px 10px;
+ display: inline-block;
+ position: relative;
+ margin-bottom: 10px;
+ border-radius: 6px;
+ border: 1px solid #d8d8d8;
+ height: 32px;
+ border-color: slategrey !important;
+ width:100%;
+ }
+.glyphicon {
+ position: relative !important;
+ line-height: 0 !important;
+}
+
+#divider-line-bottom , #divider-line
+{
+ border-bottom-style: solid;
+ border-bottom-width: 1px;
+ padding-bottom: 11px;
+
+}
diff --git a/ecomp-portal-FE-common/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.html b/ecomp-portal-FE-common/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.html
new file mode 100644
index 00000000..c619a18a
--- /dev/null
+++ b/ecomp-portal-FE-common/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.html
@@ -0,0 +1,180 @@
+<!--
+ ================================================================================
+ ECOMP Portal
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file 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.
+ ================================================================================
+ -->
+<div style="margin-top: 10px; margin-bottom: 10px;"></div>
+<br />
+
+<div style="margin-top: 25px;">
+ <div id="title" class="manage-contactUs-home-title">Manage
+ Contact Us</div>
+ <div class="contact-us-margin">
+ <div class="get-access-table">
+ <div class="table-control">
+ <div class="c-ecomp-portal-abs-table" style="height: 300px">
+ <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" row-repeat="rowData in contactUsList">
+ <tr id="tr-rowData" ng-click="">
+ <td b2b-table-body>
+ <div id="users-page-td-appName" ng-bind="rowData.appName"></div>
+ </td>
+ <td b2b-table-body>
+ <div id="users-page-td-name" ng-hide="rowData.showEdit"
+ ng-bind="rowData.contactName"></div> <input
+ class="input-inline-edit-text" type="text"
+ ng-show="rowData.showEdit"
+ ng-model="contactUsList[$index].contactName" />
+ </td>
+ <td b2b-table-body>
+ <div id="users-page-td-email" ng-hide="rowData.showEdit"
+ ng-bind="rowData.contactEmail"></div> <input
+ class="input-inline-edit-text" type="text"
+ ng-show="rowData.showEdit"
+ ng-model="contactUsList[$index].contactEmail" />
+ </td>
+ <td b2b-table-body>
+ <div id="users-page-td-url" ng-hide="rowData.showEdit"
+ ng-bind="rowData.url"></div> <input
+ class="input-inline-edit-text" type="text"
+ ng-show="rowData.showEdit" ng-model="contactUsList[$index].url" />
+ </td>
+ <td b2b-table-body>
+ <div id="users-page-td-descr" ng-hide="rowData.showEdit"
+ ng-bind=" rowData.description"></div> <input
+ class="input-inline-edit-text" type="text"
+ ng-show="rowData.showEdit"
+ ng-model="contactUsList[$index].description" />
+ </td>
+ <td b2b-table-body>
+ <div class="delete-contact-us" ng-hide="rowData.showEdit"
+ ng-click="rowData.showEdit=true">
+ <span class="icon-edit"></span>
+ </div> <span ng-show="rowData.showEdit"> <a
+ btn-type="primary"
+ ng-click="editContactUsFun(rowData); rowData.showEdit=false"
+ class="btn btn-alt btn-small" size="small">Save</a>
+ </span>
+ </td>
+ <td b2b-table-body>
+ <div class="delete-contact-us"
+ ng-click="delContactUsFun(rowData)">
+ <span class="icon-misc-trash"></span>
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <div id="divider-line"></div>
+ <div style="margin-top: 15px; margin-left: -78px;">
+ <div id="addWidgetHeader" class="contact-us-margin">
+ <h1 style="font-size: 18px;">Add Application Contact
+ Information</h1>
+ <!-- <div class="errMsg">{{errMsg}}</div> -->
+ </div>
+ <div id="addWidget" class="contact-us-margin">
+ <div>
+ <div id="add-contact-us-field-appname"
+ class="add-contact-us-field">
+ <div id="mots-property-label" class="property-label">App
+ Name</div>
+ <select id="dropdown1" name="dropdown1" b2b-dropdown
+ placeholder-text="Select an App"
+ ng-model="newContactUs.app.value">
+ <option b2b-dropdown-list
+ option-repeat="d in contactUsAllAppList" value="{{d.value}}">{{d.title}}</option>
+ </select>
+ </div>
+ <br>
+ <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" class="input-text-area"
+ type="text" ng-model="newContactUs.name" />
+ </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" class="input-text-area"
+ type="text" ng-model="newContactUs.email" />
+ </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" class="input-text-area"
+ type="text" ng-model="newContactUs.url" />
+ </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"
+ style="margin-top: 0px; margin-bottom: 0px; height: 100px"
+ ng-model="newContactUs.desc"></textarea>
+ </div>
+ </div>
+ <div style="height: 50px;">
+ <a style="float: right; margin-top: 20px"
+ class="btn btn-alt btn-small" ng-click="newContactUsFun()">Add
+ New</a>
+ </div>
+ <div id="divider-line-bottom"></div>
+
+ <div style="height: 50px;">
+ <a style="float: right; margin-right: -230px !important;"
+ class="btn btn-alt btn-small" ng-click="closeDialog()">Close</a>
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+ </div>
+ </div>
+</div>
+
+<script type="application/javascript">
+
+ $(document).ready(function(){
+ $(".ngdialog-content").css("width","85%")
+ });
+
+</script>