Initial OpenECOMP policy/engine commit
[policy/engine.git] / ecomp-sdk-app / src / main / webapp / WEB-INF / fusion / jsp / ebz / loginSnippet.html
1 <!--
2   ================================================================================
3   eCOMP Portal SDK
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
10   
11        http://www.apache.org/licenses/LICENSE-2.0
12   
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   ================================================================================
19   -->
20 <script type="text/ng-template" id="loginSnippet.html">
21           <div style="line-height: normal; right: 167px; min-height: 200px; height: auto; width: auto; " ng-controller="loginSnippetCtrl" >
22                                                                         <div id="reg-header-snippet">
23                                                                                 <div class="reg-profilePicture" style="min-height: 215px; width: auto; " id="reg-profile-links">
24                                                                                         <div id="reg-profileImage">     
25                                                                                                 <div style="clear: both; height: 80px; position: relative; width: 80px;">
26                                                                                                 
27                                                                                                         <span style="  background-position: -1px -1px; height: 81px;left: 0;position: absolute;top: 0;width: 81px;">&nbsp;</span>
28                                                                                                 </div>
29                                                                                         </div>                                          
30                                                                                         <div id="reg-logout-div">
31                                                                                                 <a class="reg-logout-btn" href="logout.htm">Log Out</a> 
32                                                                                         </div>
33                                                                                 </div>
34                                                                                 <div tabindex="0" class="reg-profileDetails" id="reg-profiledetails-id">
35                                                                                 <ul class="reg-Details-table" style="list-style: none;">
36                                                                                         <li><div class="reg-userName-table"><div id="reg-userName-table-row"><div id="reg-userName-table-cell"><h3 class="att-global-fonts" id="reg-userName" ng-bind="userProfile.fullName"></h3><span class="visuallyhidden">.</span></div></div></div></li>
37                                                                                         <li><div class="reg-userEmail-label"><span class="reg-userEmail-label-spn">EMAIL<span class="visuallyhidden">:</span></span></div></li>
38                                                                                         <li><div class="reg-userEmail-value"><span class="reg-userEmail-value-spn" ng-bind="userProfile.email"><span class="visuallyhidden">.</span></span></div></li>
39                                                                                         <li><div class="reg-userRole-label"><span class="reg-userRole-label-spn">User ID<span class="visuallyhidden">:</span></span></div></li>
40                                                                                         <li><div class="reg-userRole-value"><span class="reg-userRole-value-spn" ng-bind="userProfile.orgUserId"><span class="visuallyhidden"></span></span></div></li>                 
41                                                                                 </ul>   
42                                                                                 </div>
43                                                                                 </div>
44                                                                         </div>
45     </script>
46     <script type="text/ng-template" id="chat_box.html">
47      
48                                                                 <div style="width: auto;">
49                                                                         
50                                                                         <div style="font-size: 24px; font-family: omnes_attregular;line-height: 26px;color: #444444;text-align: center;">
51                                                                                 <span>Live Chat</span>
52                                                                         </div>
53                                                                         <div  style="line-height:15px; padding-left:20px; padding-right:20px;">
54                                                                                 Chat is currently unavailable.<br><br>
55                                                                                 
56                                                                         </div>
57                                                                 </div>   
58         </script>       
59
60 <script>
61 var loginSnippetCtrl =  function ($scope,$http, $log,UserInfoService){
62         /*Define fields*/
63         $scope.userProfile={
64                         firstName:'',
65                         lastName:'',
66                         fullName:'',
67                         email:''
68         }
69         /*Put user info into fields*/
70         $scope.inputUserInfo = function(userInfo){
71                 if (typeof(userInfo) != "undefined" && userInfo!=null && userInfo!=''){
72                         if (typeof(userInfo.USER_FIRST_NAME) != "undefined" && userInfo.USER_FIRST_NAME!=null && userInfo.USER_FIRST_NAME!='')
73                                 $scope.userProfile.firstName = userInfo.USER_FIRST_NAME;
74                         if (typeof(userInfo.USER_LAST_NAME) != "undefined" && userInfo.USER_LAST_NAME!=null && userInfo.USER_LAST_NAME!='')
75                                 $scope.userProfile.lastName = userInfo.USER_LAST_NAME;
76                         if (typeof(userInfo.USER_EMAIL) != "undefined" && userInfo.USER_EMAIL!=null && userInfo.USER_EMAIL!='')                         
77                                 $scope.userProfile.email = userInfo.USER_EMAIL;         
78                         if (typeof(userInfo.USER_ORGUSERID) != "undefined" && userInfo.USER_ORGUSERID!=null && userInfo.USER_ORGUSERID!='')                     
79                                 $scope.userProfile.orgUserId = userInfo.USER_ORGUSERID;                         
80                 }               
81         }
82          /*getting user info from session*/
83         $scope.getUserNameFromSession = function(){
84                 UserInfoService.getFunctionalMenuStaticDetailSession()
85                 .then(function (response) {
86                         var j = response;
87                         console.log(response);
88                         $scope.userProfile.fullName = response.userName;
89                         $scope.userProfile.orgUserId = response.orgUserId;
90                         $scope.userProfile.email = response.email;
91                 });
92     }
93         /*getting user info from shared context*/
94         $scope.getUserName=function() {
95                 var promise = UserInfoService.getFunctionalMenuStaticDetailShareContext();
96                 promise.then(
97                         function(res) { 
98                                 if(res==null || res==''){
99                                         $log.info('Getting User information from session');
100                                         $scope.getUserNameFromSession();
101                                 }else{
102                                         $log.info('Received User information from shared context',res);
103                                         var resData = res;
104                                         $scope.inputUserInfo(resData);                                  
105                                         $scope.userProfile.fullName = $scope.userProfile.firstName+ ' '+ $scope.userProfile.lastName;                                   
106                                 }
107                         },
108                         function(err) {
109                                 console.log('error');
110                         }
111                 );
112     };
113     /*call the get user info function*/
114     try{        
115         $scope.getUserName();
116     }catch(err){
117         $log.info('Error while getting User information',err);
118     }
119 }
120  </script>