Commit 55309a92f22ce274d4481d424e398ddcc2a61c32

Authored by Birendra Kumar
1 parent ec08e325

few bug fixed in admin section

400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -447,7 +447,19 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
447 447 //6. reset the isCommingSoonModel to false in local storage so that upcomming module pop up would not show again to the user after firts time
448 448 localStorage.setItem('isCommingSoonModel', false);
449 449  
450   - $location.path('/');
  450 + // for reseller type user first need to update profile
  451 + if (result.UserTypeId == 7 && (result.FirstName == "" || result.EmailId == "" || result.LastName == "")) {
  452 +
  453 + $('#updateprofile').html(LoginMessageConstants.USER_UPDATE_PROFILE);
  454 +
  455 + $("#profileUpdateModal").modal('show');
  456 +
  457 + $(".modal-backdrop").css("opacity", ".5");
  458 +
  459 + }
  460 + else {
  461 + $location.path('/');
  462 + }
451 463 }
452 464 else {
453 465 if ($('#dvTerms').length > 0) {
... ... @@ -5741,7 +5753,11 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
5741 5753 }
5742 5754  
5743 5755 $rootScope.reDirectURLToAdmin = function () {
5744   - window.location.href = "Admin";
  5756 + $("#profileUpdateModal").modal('hide');
  5757 + $timeout(function () {
  5758 + window.location.href = "Admin";
  5759 + }, 300)
  5760 +
5745 5761 };
5746 5762  
5747 5763 $rootScope.SendAdminAccessRequestMail = function (userInfo) {
... ...
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
... ... @@ -367,6 +367,7 @@ AIA.constant("LoginConstants", {
367 367 });
368 368  
369 369 AIA.constant("LoginMessageConstants", {
  370 + "USER_UPDATE_PROFILE":"Please update your profile first",
370 371 "USER_OR_PASSWORD_INCORRECT": "UserId or Password is incorrect.",
371 372 "RESET_PASSWORD": "Please check you email and reset your password.",
372 373 "USERID_SENT_IN_EMAIL": "We have sent you userId in email.",
... ...
400-SOURCECODE/AIAHTML5.Web/index.aspx
... ... @@ -1056,6 +1056,31 @@
1056 1056 </div>
1057 1057 </div>
1058 1058  
  1059 + <!--Profile not updated modal-->
  1060 +
  1061 + <div class=" fade ui-draggable in" data-keyboard="false" data-backdrop="static" id="profileUpdateModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" style="padding-left: 17px; display: none; z-index: 1200002; position: fixed; top: 0; overflow-x: hidden; overflow-y: auto; width:100% ;height:100%">
  1062 + <div class="modal-dialog" role="document" style="width:400px">
  1063 + <div class="modal-content">
  1064 + <div class="modal-header ui-draggable-handle " style="background-color: #0095da; border-color: #007ab3;cursor:default; padding:5px">
  1065 + <h4 style="color:#fff; text-align:left;">Alert</h4>
  1066 + </div>
  1067 +
  1068 + <div class="modal-body" style="width: 300px; height: 100px; overflow-x: auto;">
  1069 + <div class="panel-body">
  1070 + <div id="updateprofile" style="font-size: 15px;"></div>
  1071 + </div>
  1072 + </div>
  1073 + <div class="modal-footer ui-draggable-handle " style="color: #ffffff; cursor:default;">
  1074 +
  1075 + <form class="form-horizontal">
  1076 +
  1077 + <div style="float: right;"><button type="button" class="btn btn-primary btn-sm" data-toggle="modal" ng-click="reDirectURLToAdmin()">OK</button></div>
  1078 + </form>
  1079 + </div>
  1080 + </div>
  1081 + </div>
  1082 + </div>
  1083 +
1059 1084 <!--Export Image Modal-->
1060 1085 <div class="modal fade export-image ui-draggable in" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
1061 1086 style="z-index: 1200002;">
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/unblockuser.component.ts
... ... @@ -109,15 +109,23 @@ export class UnblockUser implements OnInit {
109 109  
110 110 GetBlockUserList(this)
111 111 {
112   - if (this.commonService.UserTypeName == 'District Admin') {
113   - this.licId = this.commonService.AccLicId;
114   - }
115   - else if (this.commonService.UserTypeName == 'Client Admin') {
116   - this.licId = this.commonService.AccLicId;
  112 + if (this.commonService.UserTypeName == "Client Admin" || this.commonService.UserTypeName == "District Admin")
  113 + {
  114 + if(this.commonService.AccountNumber !=undefined && this.commonService.AccountNumber !="")
  115 + {
  116 + this.licId = this.commonService.AccLicId;
  117 + }
  118 + else
  119 + {
  120 + this.licId =0
  121 + }
  122 +
117 123 }
118   - else {
  124 + else
  125 + {
119 126 this.licId =0
120 127 }
  128 +
121 129 var UserFilterControl = this.UnBlockedUserFrm.value;
122 130 this.userservice.GetBlockUserList(
123 131 {
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/updateuserprofile.component.html
... ... @@ -21,25 +21,26 @@
21 21 </div>
22 22 <div class="form-group">
23 23  
24   - <label for="inputEmail3" class="col-sm-4 control-label">First Name <span class="red">*</span> :</label>
  24 + <label for="firstName" class="col-sm-4 control-label">First Name <span class="red">*</span> :</label>
25 25 <div class="col-sm-7">
26   - <input type="text" formControlName="firstName" class="form-control" id="inputEmail3">
27   - <div *ngIf="!userFrm.controls.firstName.valid && userFrm.controls.firstName.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">First Name is required</div>
  26 + <input type="text" formControlName="firstName" class="form-control" id="firstName">
  27 + <div *ngIf="(userFrm.controls.firstName.invalid && userFrm.controls.firstName.dirty)" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">First Name is required</div>
28 28 </div>
29 29 </div>
30 30 <div class="form-group">
31   - <label for="inputPassword3" class="col-sm-4 control-label">Last Name <span class="red">*</span> :</label>
  31 + <label for="lastName" class="col-sm-4 control-label">Last Name <span class="red">*</span> :</label>
32 32 <div class="col-sm-7">
33   - <input type="text" class="form-control" id="inputPassword3" formControlName="lastName">
34   - <div *ngIf="!userFrm.controls.lastName.valid && userFrm.controls.lastName.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Last Name is required</div>
  33 + <input type="text" class="form-control" id="lastName" formControlName="lastName">
  34 + <div *ngIf="(!userFrm.controls.lastName.valid && userFrm.controls.lastName.dirty)" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Last Name is required</div>
35 35 </div>
36 36 </div>
37 37 <div class="form-group">
38   - <label for="inputPassword3" class="col-sm-4 control-label">Email Id <span class="red">*</span> :</label>
  38 + <label for="emailId" class="col-sm-4 control-label">Email Id <span class="red">*</span> :</label>
39 39 <div class="col-sm-7">
40   - <input type="text" class="form-control" id="inputPassword3" formControlName="emailId">
41   - <div *ngIf="userFrm.controls.emailId.hasError('required') && userFrm.controls.emailId.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Email is required</div>
42   - <div *ngIf="userFrm.controls.emailId.hasError('email') && userFrm.controls.emailId.dirty && !userFrm.controls.emailId.hasError('required')" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Email is invalid</div>
  40 + <input type="text" class="form-control" id="emailId" formControlName="emailId" pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,3}$">
  41 + <div *ngIf="userFrm.controls.emailId.invalid && !userFrm.controls.emailId.value && userFrm.controls.emailId.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Email Id is required</div>
  42 +
  43 + <div *ngIf="userFrm.controls.emailId.invalid && userFrm.controls.emailId.value" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;"> Email is Invalid. </div>
43 44 </div>
44 45 </div>
45 46 <div class="form-group">
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/updateuserprofile.component.ts
... ... @@ -44,17 +44,14 @@ export class UpdateUserProfile implements OnInit {
44 44 ngOnInit(): void {
45 45 this.user = new User();
46 46 this.alerts = '';
47   - //this.userservice.GetUserById(this.UserId);
48 47 this.userFrm = this.fb.group({
49 48 id: [''],
50   - firstName: ['', Validators.required],
51   - lastName: ['', Validators.required],
52   - emailId: ['', [Validators.required, Validators.email]]
53   - // LastName: [''],
54   - // Gender: ['', Validators.required],
55   - // Email: ['']
  49 + firstName: ['', [Validators.required,this.noWhitespaceValidator]],
  50 + lastName: ['', [Validators.required,this.noWhitespaceValidator]],
  51 + emailId: ['', [Validators.required,this.noWhitespaceValidator]]
56 52  
57 53 });
  54 +
58 55 this._loadingService.ShowLoading("global-loading");
59 56 this.GetUserById();
60 57  
... ... @@ -62,21 +59,30 @@ export class UpdateUserProfile implements OnInit {
62 59 redirect() {
63 60 this.router.navigate(['/']);
64 61 }
65   - //ngAfterviewint() {
66   - // this.LoadUsers();
67   - //}
68   -
69   -
70   - //getCustomerById(UserId) {
71   - // return this.userservice.GetUserById(UserId)
72   - // .map((response: Response) => response.json())
73   - // .catch(this._errorHandler)
74   - //}
75   - //formErrors = {
76   - // 'firstName': '',
77   - // 'lastName': '',
78   - // 'email': ''
79   - //};
  62 + public noWhitespaceValidator(control: FormControl) {
  63 + // new validation for intial whaite space
  64 + //****Birendra *****/
  65 + var isValid=false;
  66 + if(control.value!=null)
  67 + {
  68 + var controlLen=control.value.length;
  69 + if(controlLen!=0)
  70 + {
  71 + const isWhitespace = (control.value || '').trim().length === 0;
  72 + isValid = !isWhitespace;
  73 + if(!isValid)
  74 + {
  75 + control.setValue('');
  76 +
  77 + }
  78 + }
  79 + }
  80 + // can use also on page of input control
  81 + //
  82 + return isValid ? null: { 'whitespace': true };
  83 +
  84 +}
  85 +
80 86 GetUserById() {
81 87  
82 88 this.userservice.GetUserById()
... ... @@ -84,24 +90,35 @@ export class UpdateUserProfile implements OnInit {
84 90 this._loadingService.HideLoading("global-loading");
85 91 }
86 92 UpdateUserProfile() {
87   - // debugger;
88   - this.user = this.userFrm.value;
89   - //if(this.user.)
90   - //console.log(this.user);
91   - var obj = this.user
92   - if (this.userFrm.valid) {
93   - return this.userservice.UpdateUserProfileById(obj)
  93 + this.alerts = '';
  94 + if (this.userFrm.value.firstName == null ||((this.userFrm.value.firstName).trim() == ''))
  95 + {
  96 + this.alerts += '<span>First name is required.</span></br>';
  97 + }
  98 + if (this.userFrm.value.lastName == null ||((this.userFrm.value.lastName).trim() == ''))
  99 + {
  100 + this.alerts += '<span>Last name is required.</span></br>';
  101 + }
  102 + if (this.userFrm.value.emailId == null ||((this.userFrm.value.emailId).trim() == '')) {
  103 + this.alerts += '<span>Email Id is required.</span>';
  104 + }
  105 + else if((!this.userFrm.controls.emailId.valid))
  106 + {
  107 + this.alerts += '<span>Enter Valid Email Id.</span>';
  108 + }
  109 +
  110 +
  111 + if (this.userFrm.valid && this.alerts == '') {
  112 + var obj = this.userFrm.value;
  113 +
  114 + return this.userservice.UpdateUserProfileById(obj)
94 115 .subscribe(
95 116 n => (this.AfterInsertData(n)),
96 117 error => this.error = <any>error);
97 118 }
98 119 }
99 120 AfterInsertData(data) {
100   - debugger;
101   - if (data.Status == "False") {
102   - // this._confirmService.activate(data.ResponseMessage, "alertMsg");
103   - //setTimeout(() => this.amCode.nativeElement.focus(), 0);
104   - // this.closeflag = false;
  121 + if (data.Status == "False") {
105 122 return false;
106 123 } else {
107 124 this.status = true;
... ... @@ -112,34 +129,9 @@ export class UpdateUserProfile implements OnInit {
112 129 localStorage.setItem("loggedInUserDetails", JSON.stringify(loggedInUser));
113 130 this.global.DisplayName = loggedInUser.FirstName + " " + loggedInUser.LastName;
114 131 this._confirmService.activate("User Profile Updated Successfully.", "alertMsg");
115   - // window.location.href = this.global.LiveURL;
116   -
117   -
118   - //this.profileModal.open();
119   - // this.submitted = false;
120   - // this.GetAllAcctMgr();
121   - // this.DisableAllControls();
122   - // this.AccountManagerID.enable();
123   - // let accountManagerID: string = data.Id == null ? "" : data.Id.toString();
124   - // console.log(accountManagerID);
125   -
126   - // this.GetAcctMgr(Number(accountManagerID));
127   - //this.GetAccountManagerListOptions(false);
128   - // this.defautValue = data.id;
129   - // this.BtnReset = true;
130   - // this.BtnSave = true;
131   - // this.BtnEdit = false;
132   - // this.BtnNew = false;
133   - // this.BtnDelete = false;
134   - // this.Abbrevtion = this.Abbrev.value;
135   - // setTimeout(() => this.AMform.controls["AccountManagerID"].setValue(accountManagerID.toString()), 1000);
136   - // setTimeout(() => this.AMform.markAsPristine(), 2000);
  132 +
137 133 }
138   - //if (this.closeflag) {
139   - // this.close.emit(null);
140   - //}
141   - //else {
142   - //}
  134 +
143 135 }
144 136 bindUsers(data) {
145 137  
... ... @@ -152,23 +144,8 @@ export class UpdateUserProfile implements OnInit {
152 144 this.userFrm.controls['firstName'].setValue(this.user.FirstName)
153 145 this.userFrm.controls['lastName'].setValue(this.user.LastName)
154 146 this.userFrm.controls['emailId'].setValue(this.user.EmailId)
155   - // this.GetClientListOptions(false);
156   - // this.GetCrossRefClientListOptions(false);
157 147 }
158   - //extractData(res: Response) {
159   - // //debugger;
160   - // let body = res.json();
161   - // return body;
162   - //}
163   - //handleError(error: any) {
164   -
165   - // // In a real world app, we might use a remote logging infrastructure
166   - // // We'd also dig deeper into the error to get a better message
167   - // let errMsg = (error.message) ? error.message :
168   - // error.status ? `${error.status} - ${error.statusText}` : 'Server error';
169   - // console.error(errMsg); // log to console instead
170   - // return Observable.throw(errMsg);
171   - //}
  148 +
172 149 validationMessages = {
173 150 'firstName': {
174 151 'required': 'First name is required.'
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts
... ... @@ -114,9 +114,14 @@ export class UsersList implements OnInit, AfterViewChecked {
114 114  
115 115 });
116 116  
117   - if (this.global.UserTypeName == "Client Admin" || this.global.UserTypeName == "District Admin") {
118   - this.Users.controls['AccountNumber'].setValue(this.global.AccountNumber)
119   - this.DisableAccountNumberControl = true;
  117 + if (this.global.UserTypeName == "Client Admin" || this.global.UserTypeName == "District Admin" )
  118 + {
  119 + if(this.global.AccountNumber !=undefined && this.global.AccountNumber !="")
  120 + {
  121 + this.Users.controls['AccountNumber'].setValue(this.global.AccountNumber)
  122 + this.DisableAccountNumberControl = true;
  123 + }
  124 +
120 125 }
121 126 this._loadingService.ShowLoading("global-loading");
122 127 this.GetUserType();
... ...
400-SOURCECODE/Admin/src/assets/data/Menu.json
... ... @@ -1275,19 +1275,19 @@
1275 1275 {
1276 1276 "HeaderMenuId": "101",
1277 1277 "HeaderMenuName": "Licenses",
1278   - "HeaderMenuStatus": "True",
  1278 + "HeaderMenuStatus": "False",
1279 1279 "SubMenu": [
1280 1280 {
1281 1281 "SubMenuId": "203",
1282 1282 "SubMenuName": "Search License",
1283 1283 "SubMenuUrl": "searchlicense",
1284   - "SubMenuStatus": "True"
  1284 + "SubMenuStatus": "False"
1285 1285 },
1286 1286 {
1287 1287 "SubMenuId": "204",
1288 1288 "SubMenuName": "Add New License",
1289 1289 "SubMenuUrl": "addlicense",
1290   - "SubMenuStatus": "True"
  1290 + "SubMenuStatus": "False"
1291 1291 }
1292 1292  
1293 1293 ]
... ... @@ -1295,19 +1295,19 @@
1295 1295 {
1296 1296 "HeaderMenuId": "102",
1297 1297 "HeaderMenuName": "Product Features",
1298   - "HeaderMenuStatus": "True",
  1298 + "HeaderMenuStatus": "False",
1299 1299 "SubMenu": [
1300 1300 {
1301 1301 "SubMenuId": "205",
1302 1302 "SubMenuName": "Manage Discount Code",
1303 1303 "SubMenuUrl": "managediscountcode",
1304   - "SubMenuStatus": "True"
  1304 + "SubMenuStatus": "False"
1305 1305 },
1306 1306 {
1307 1307 "SubMenuId": "206",
1308 1308 "SubMenuName": "Subscription Price",
1309 1309 "SubMenuUrl": "subscriptionprice",
1310   - "SubMenuStatus": "True"
  1310 + "SubMenuStatus": "False"
1311 1311 }
1312 1312  
1313 1313 ]
... ... @@ -1315,31 +1315,31 @@
1315 1315 {
1316 1316 "HeaderMenuId": "103",
1317 1317 "HeaderMenuName": "Users",
1318   - "HeaderMenuStatus": "True",
  1318 + "HeaderMenuStatus": "False",
1319 1319 "SubMenu": [
1320 1320 {
1321 1321 "SubMenuId": "207",
1322 1322 "SubMenuName": "List User",
1323 1323 "SubMenuUrl": "users",
1324   - "SubMenuStatus": "True"
  1324 + "SubMenuStatus": "False"
1325 1325 },
1326 1326 {
1327 1327 "SubMenuId": "208",
1328 1328 "SubMenuName": "Add User",
1329 1329 "SubMenuUrl": "adduser",
1330   - "SubMenuStatus": "True"
  1330 + "SubMenuStatus": "False"
1331 1331 },
1332 1332 {
1333 1333 "SubMenuId": "209",
1334 1334 "SubMenuName": "Unblock User",
1335 1335 "SubMenuUrl": "unblockuser",
1336   - "SubMenuStatus": "True"
  1336 + "SubMenuStatus": "False"
1337 1337 },
1338 1338 {
1339 1339 "SubMenuId": "210",
1340 1340 "SubMenuName": "User Group",
1341 1341 "SubMenuUrl": "usergroup",
1342   - "SubMenuStatus": "True"
  1342 + "SubMenuStatus": "False"
1343 1343 }
1344 1344  
1345 1345 ]
... ... @@ -1347,49 +1347,49 @@
1347 1347 {
1348 1348 "HeaderMenuId": "104",
1349 1349 "HeaderMenuName": "Reports",
1350   - "HeaderMenuStatus": "True",
  1350 + "HeaderMenuStatus": "False",
1351 1351 "SubMenu": [
1352 1352 {
1353 1353 "SubMenuId": "211",
1354 1354 "SubMenuName": "Usage Report",
1355 1355 "SubMenuUrl": "usagereport",
1356   - "SubMenuStatus": "True"
  1356 + "SubMenuStatus": "False"
1357 1357 },
1358 1358 {
1359 1359 "SubMenuId": "212",
1360 1360 "SubMenuName": "Customer Summary Report",
1361 1361 "SubMenuUrl": "customersummaryreport",
1362   - "SubMenuStatus": "True"
  1362 + "SubMenuStatus": "False"
1363 1363 },
1364 1364 {
1365 1365 "SubMenuId": "213",
1366 1366 "SubMenuName": "Expiring Subscription Report",
1367 1367 "SubMenuUrl": "expiringsubscriptionreport",
1368   - "SubMenuStatus": "True"
  1368 + "SubMenuStatus": "False"
1369 1369 },
1370 1370 {
1371 1371 "SubMenuId": "214",
1372 1372 "SubMenuName": "New Subscription Report",
1373 1373 "SubMenuUrl": "subscriptionreport",
1374   - "SubMenuStatus": "True"
  1374 + "SubMenuStatus": "False"
1375 1375 },
1376 1376 {
1377 1377 "SubMenuId": "215",
1378 1378 "SubMenuName": "Subscription Cancellation Report",
1379 1379 "SubMenuUrl": "subscriptioncancellationreport",
1380   - "SubMenuStatus": "True"
  1380 + "SubMenuStatus": "False"
1381 1381 },
1382 1382 {
1383 1383 "SubMenuId": "216",
1384 1384 "SubMenuName": "Net AD Subscription Report",
1385 1385 "SubMenuUrl": "netadsubscriptionreport",
1386   - "SubMenuStatus": "True"
  1386 + "SubMenuStatus": "False"
1387 1387 },
1388 1388 {
1389 1389 "SubMenuId": "217",
1390 1390 "SubMenuName": "Site License Usage Report",
1391 1391 "SubMenuUrl": "sitelicenseusagereport",
1392   - "SubMenuStatus": "True"
  1392 + "SubMenuStatus": "False"
1393 1393 },
1394 1394 {
1395 1395 "SubMenuId": "218",
... ... @@ -1409,13 +1409,13 @@
1409 1409 {
1410 1410 "HeaderMenuId": "105",
1411 1411 "HeaderMenuName": "Site Account",
1412   - "HeaderMenuStatus": "True",
  1412 + "HeaderMenuStatus": "False",
1413 1413 "SubMenu": [
1414 1414 {
1415 1415 "SubMenuId": "220",
1416 1416 "SubMenuName": "Add Building Level Account",
1417 1417 "SubMenuUrl": "sitelicenseaccount",
1418   - "SubMenuStatus": "True"
  1418 + "SubMenuStatus": "False"
1419 1419 }
1420 1420  
1421 1421 ]
... ... @@ -1423,19 +1423,19 @@
1423 1423 {
1424 1424 "HeaderMenuId": "106",
1425 1425 "HeaderMenuName": "Settings",
1426   - "HeaderMenuStatus": "True",
  1426 + "HeaderMenuStatus": "False",
1427 1427 "SubMenu": [
1428 1428 {
1429 1429 "SubMenuId": "221",
1430 1430 "SubMenuName": "View-Update Profile",
1431 1431 "SubMenuUrl": "editlicensebasicsettings",
1432   - "SubMenuStatus": "True"
  1432 + "SubMenuStatus": "False"
1433 1433 },
1434 1434 {
1435 1435 "SubMenuId": "222",
1436 1436 "SubMenuName": "Manage Modesty Settings",
1437 1437 "SubMenuUrl": "licensemodestysettings",
1438   - "SubMenuStatus": "True"
  1438 + "SubMenuStatus": "False"
1439 1439 },
1440 1440 {
1441 1441 "SubMenuId": "223",
... ...