Commit ef15bbbb5e99d68e9cf7248fb00bfac4f6c70a97

Authored by Birendra Kumar
2 parents aa9c8553 ffc75fd8

add profile update modal popup

Showing 22 changed files with 693 additions and 287 deletions
400-SOURCECODE/AIAHTML5.ADMIN.API/Models/LicenseModel.cs
@@ -168,7 +168,7 @@ namespace AIAHTML5.ADMIN.API.Models @@ -168,7 +168,7 @@ namespace AIAHTML5.ADMIN.API.Models
168 LicenseObj.TotalRenewals = result[0].TotalRenewals; 168 LicenseObj.TotalRenewals = result[0].TotalRenewals;
169 LicenseObj.SubscriptionStartDate = (result[0].SubscriptionStartDate == null ? DateTime.MinValue : result[0].SubscriptionStartDate.Value); 169 LicenseObj.SubscriptionStartDate = (result[0].SubscriptionStartDate == null ? DateTime.MinValue : result[0].SubscriptionStartDate.Value);
170 LicenseObj.SubscriptionEndDate = (result[0].SubscriptionEndDate == null ? DateTime.MinValue : result[0].SubscriptionEndDate.Value); 170 LicenseObj.SubscriptionEndDate = (result[0].SubscriptionEndDate == null ? DateTime.MinValue : result[0].SubscriptionEndDate.Value);
171 - LicenseObj.RenewDate = (result[0].RenewalDate == null ? DateTime.MinValue : result[0].RenewalDate.Value); 171 + LicenseObj.RenewDate = DateTime.Now.Date;// (result[0].RenewalDate == null ? DateTime.Now.Date : result[0].RenewalDate.Value);
172 } 172 }
173 } 173 }
174 catch (Exception ex) { } 174 catch (Exception ex) { }
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
@@ -754,11 +754,23 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -754,11 +754,23 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
754 754
755 //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 755 //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
756 localStorage.setItem('isCommingSoonModel', false); 756 localStorage.setItem('isCommingSoonModel', false);
  757 +
  758 + // for reseller type user first need to update profile
  759 + // only instructor ,not student
  760 + if (result.UserTypeId == 7 && result.EditionId == 1 && (result.FirstName == "" || result.EmailId == "" || result.LastName == "")) {
757 761
758 - $location.path('/'); 762 + $('#updateprofile').html(LoginMessageConstants.USER_UPDATE_PROFILE);
  763 +
  764 + $("#profileUpdateModal").modal('show');
  765 +
  766 + $(".modal-backdrop").css("opacity", ".5");
  767 +
  768 + }
  769 + else {
  770 + $location.path('/');
  771 + }
759 } 772 }
760 - else  
761 - { 773 + else {
762 if ($('#dvTerms').length > 0) { 774 if ($('#dvTerms').length > 0) {
763 $('#dvTerms').html(result.TermsAndConditionsText); 775 $('#dvTerms').html(result.TermsAndConditionsText);
764 } 776 }
@@ -1145,6 +1157,20 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -1145,6 +1157,20 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1145 $rootScope.userData = userInfo; 1157 $rootScope.userData = userInfo;
1146 $rootScope.userModules = userInfo.Modules; 1158 $rootScope.userModules = userInfo.Modules;
1147 // ShowAssignedModulesPopup(userInfo.Modules);; 1159 // ShowAssignedModulesPopup(userInfo.Modules);;
  1160 + // for reseller type user first need to update profile
  1161 + // allow popup for instructor ,not for student.
  1162 + if (userInfo.UserTypeId == 7 && userInfo.EditionId == 1 && (userInfo.FirstName == "" || userInfo.EmailId == "" || userInfo.LastName == "")) {
  1163 +
  1164 + $('#updateprofile').html(LoginMessageConstants.USER_UPDATE_PROFILE);
  1165 +
  1166 + $("#profileUpdateModal").modal('show');
  1167 +
  1168 + $(".modal-backdrop").css("opacity", ".5");
  1169 +
  1170 + }
  1171 + else {
  1172 + $location.path('/');
  1173 + }
1148 } 1174 }
1149 } 1175 }
1150 } 1176 }
@@ -6866,7 +6892,11 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -6866,7 +6892,11 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
6866 } 6892 }
6867 6893
6868 $rootScope.reDirectURLToAdmin = function () { 6894 $rootScope.reDirectURLToAdmin = function () {
6869 - window.location.href = "Admin"; 6895 + $("#profileUpdateModal").modal('hide');
  6896 + $timeout(function () {
  6897 + window.location.href = "Admin";
  6898 + }, 300)
  6899 +
6870 }; 6900 };
6871 6901
6872 $rootScope.SendAdminAccessRequestMail = function (userInfo) { 6902 $rootScope.SendAdminAccessRequestMail = function (userInfo) {
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
@@ -388,6 +388,7 @@ AIA.constant("LoginConstants", { @@ -388,6 +388,7 @@ AIA.constant("LoginConstants", {
388 }); 388 });
389 389
390 AIA.constant("LoginMessageConstants", { 390 AIA.constant("LoginMessageConstants", {
  391 + "USER_UPDATE_PROFILE":"Please update your profile first",
391 "USER_OR_PASSWORD_INCORRECT": "UserId or Password is incorrect.", 392 "USER_OR_PASSWORD_INCORRECT": "UserId or Password is incorrect.",
392 "RESET_PASSWORD": "Please check you email and reset your password.", 393 "RESET_PASSWORD": "Please check you email and reset your password.",
393 "USERID_SENT_IN_EMAIL": "We have sent you userId in email.", 394 "USERID_SENT_IN_EMAIL": "We have sent you userId in email.",
400-SOURCECODE/AIAHTML5.Web/index.aspx
@@ -1081,6 +1081,30 @@ @@ -1081,6 +1081,30 @@
1081 1081
1082 </div> 1082 </div>
1083 1083
  1084 + <!--Profile not updated modal-->
  1085 + <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%">
  1086 + <div class="modal-dialog" role="document" style="width:400px">
  1087 + <div class="modal-content">
  1088 + <div class="modal-header ui-draggable-handle " style="background-color: #0095da; border-color: #007ab3;cursor:default; padding:5px">
  1089 + <h4 style="color:#fff; text-align:left;">Alert</h4>
  1090 + </div>
  1091 +
  1092 + <div class="modal-body" style="width: 300px; height: 100px; overflow-x: auto;">
  1093 + <div class="panel-body">
  1094 + <div id="updateprofile" style="font-size: 15px;"></div>
  1095 + </div>
  1096 + </div>
  1097 + <div class="modal-footer ui-draggable-handle " style="color: #ffffff; cursor:default;">
  1098 +
  1099 + <form class="form-horizontal">
  1100 +
  1101 + <div style="float: right;"><button type="button" class="btn btn-primary btn-sm" data-toggle="modal" ng-click="reDirectURLToAdmin()">OK</button></div>
  1102 + </form>
  1103 + </div>
  1104 + </div>
  1105 + </div>
  1106 + </div>
  1107 +
1084 <!--Export Image Modal--> 1108 <!--Export Image Modal-->
1085 <div class="modal fade export-image ui-draggable in" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" 1109 <div class="modal fade export-image ui-draggable in" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
1086 style="z-index: 1200002;"> 1110 style="z-index: 1200002;">
400-SOURCECODE/Admin/src/app/app.component.html
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 <a href="#" *ngIf="item.HeaderMenuStatus=='True'" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{item.HeaderMenuName}}<span class="caret"></span></a> 33 <a href="#" *ngIf="item.HeaderMenuStatus=='True'" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{item.HeaderMenuName}}<span class="caret"></span></a>
34 <ul class="dropdown-menu"> 34 <ul class="dropdown-menu">
35 <li *ngFor="let item1 of item.SubMenu"> 35 <li *ngFor="let item1 of item.SubMenu">
36 - <a *ngIf="item1.SubMenuStatus=='True'" [routerLink]="item1.SubMenuUrl">{{item1.SubMenuName}}</a> 36 + <a *ngIf="item1.SubMenuStatus=='True'" [routerLink]="item1.SubMenuUrl" [id]="item1.SubMenuId">{{item1.SubMenuName}}</a>
37 </li> 37 </li>
38 </ul> 38 </ul>
39 </li> 39 </li>
400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.html
@@ -104,7 +104,7 @@ @@ -104,7 +104,7 @@
104 </div> 104 </div>
105 <div class="checkbox" *ngIf="license.LicenseId > 0"> 105 <div class="checkbox" *ngIf="license.LicenseId > 0">
106 <label> 106 <label>
107 - <input formControlName="renew" type="checkbox" /> <span style="font-weight: bold">Renew</span> 107 + <input formControlName="renew" type="checkbox" (change)="reNewChange($event.target.checked)" /> <span style="font-weight: bold">Renew</span>
108 </label> 108 </label>
109 </div> 109 </div>
110 </div> 110 </div>
@@ -276,7 +276,7 @@ @@ -276,7 +276,7 @@
276 <div class="form-group marginTop5"> 276 <div class="form-group marginTop5">
277 <label for="Phone" class="col-sm-12 col-lg-6 control-label text-right-lg paddTop7 padd-left0" title="">Phone <span class="red">*</span> : </label> 277 <label for="Phone" class="col-sm-12 col-lg-6 control-label text-right-lg paddTop7 padd-left0" title="">Phone <span class="red">*</span> : </label>
278 <div class="col-sm-12 col-lg-6 padd-left0 padd-right0"> 278 <div class="col-sm-12 col-lg-6 padd-left0 padd-right0">
279 - <input type="text" class="form-control input-sm" id="Phone" formControlName="phone" maxlength="30"> 279 + <input type="text" class="form-control input-sm" id="Phone" formControlName="phone" maxlength="30" (keyup)="onKeyUp($event)">
280 <span class="help-block">(xxx-xxx-xxxx)</span> 280 <span class="help-block">(xxx-xxx-xxxx)</span>
281 <div *ngIf="insertUpdateLicenseFrm.controls.phone.hasError('required') && insertUpdateLicenseFrm.controls.phone.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Phone is required</div> 281 <div *ngIf="insertUpdateLicenseFrm.controls.phone.hasError('required') && insertUpdateLicenseFrm.controls.phone.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Phone is required</div>
282 <div *ngIf="insertUpdateLicenseFrm.controls.phone.hasError('pattern') && (insertUpdateLicenseFrm.controls.phone.dirty || license.LicenseId > 0)" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Phone is invalid</div> 282 <div *ngIf="insertUpdateLicenseFrm.controls.phone.hasError('pattern') && (insertUpdateLicenseFrm.controls.phone.dirty || license.LicenseId > 0)" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Phone is invalid</div>
@@ -292,9 +292,9 @@ @@ -292,9 +292,9 @@
292 <div class="form-group marginTop5"> 292 <div class="form-group marginTop5">
293 <label for="Email" class="col-sm-12 col-lg-6 control-label text-right-lg paddTop7 padd-left0" title="">Email ID <span class="red">*</span> : </label> 293 <label for="Email" class="col-sm-12 col-lg-6 control-label text-right-lg paddTop7 padd-left0" title="">Email ID <span class="red">*</span> : </label>
294 <div class="col-sm-12 col-lg-6 padd-left0 padd-right0"> 294 <div class="col-sm-12 col-lg-6 padd-left0 padd-right0">
295 - <input type="email" class="form-control input-sm" id="Email" formControlName="emailId" maxlength="50">  
296 - <div *ngIf="insertUpdateLicenseFrm.controls.emailId.hasError('required') && insertUpdateLicenseFrm.controls.emailId.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Email is required</div>  
297 - <div *ngIf="insertUpdateLicenseFrm.controls.emailId.hasError('email') && insertUpdateLicenseFrm.controls.emailId.value != '' && insertUpdateLicenseFrm.controls.emailId.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Email is invalid</div> 295 + <input type="text" class="form-control input-sm" id="Email" formControlName="emailId" maxlength="50" pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,3}$">
  296 + <div *ngIf="insertUpdateLicenseFrm.controls.emailId.hasError('required') && !insertUpdateLicenseFrm.controls.emailId.value && insertUpdateLicenseFrm.controls.emailId.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Email is required</div>
  297 + <div *ngIf="insertUpdateLicenseFrm.controls.emailId.invalid && insertUpdateLicenseFrm.controls.emailId.value" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Email is invalid</div>
298 </div> 298 </div>
299 </div> 299 </div>
300 </div> 300 </div>
400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.ts
@@ -35,15 +35,15 @@ export class AddLicense implements OnInit { @@ -35,15 +35,15 @@ export class AddLicense implements OnInit {
35 divClass: string = ''; 35 divClass: string = '';
36 topPos: string = '2000px'; 36 topPos: string = '2000px';
37 datePipe: DatePipe = new DatePipe('en-US'); 37 datePipe: DatePipe = new DatePipe('en-US');
38 - bsValue1: Date = null;//new Date(); 38 + bsValue1: Date =new Date();
39 bsValue2: Date = null;//new Date(); 39 bsValue2: Date = null;//new Date();
40 bsValue3: Date = null;//new Date(); 40 bsValue3: Date = null;//new Date();
41 modalRef: BsModalRef; 41 modalRef: BsModalRef;
42 editionLoginsText: string; 42 editionLoginsText: string;
43 rowIndex: number = 0; 43 rowIndex: number = 0;
44 ParamsObj: any; 44 ParamsObj: any;
45 - // minDate = new Date(1110, 11, 1);  
46 minDate = new Date(); 45 minDate = new Date();
  46 + startDate= new Date();
47 maxDate = new Date(9999, 11, 31); 47 maxDate = new Date(9999, 11, 31);
48 bsConfig: Partial<BsDatepickerConfig>; 48 bsConfig: Partial<BsDatepickerConfig>;
49 dateStartInvalid: boolean = false; 49 dateStartInvalid: boolean = false;
@@ -63,39 +63,40 @@ export class AddLicense implements OnInit { @@ -63,39 +63,40 @@ export class AddLicense implements OnInit {
63 this.editionLoginsText = ''; 63 this.editionLoginsText = '';
64 this.insertUpdateLicenseFrm = this.fb.group({ 64 this.insertUpdateLicenseFrm = this.fb.group({
65 licenseId: [0], 65 licenseId: [0],
66 - accountNumber: ['', Validators.required], 66 + accountNumber: ['', [Validators.required,this.noWhitespaceValidator]],
67 accountTypeId: [0, Validators.min(1)], 67 accountTypeId: [0, Validators.min(1)],
68 productId: [''], 68 productId: [''],
69 - licenseeFirstName: ['', Validators.required],  
70 - licenseeLastName: ['', Validators.required], 69 + licenseeFirstName: ['', [Validators.required,this.noWhitespaceValidator]],
  70 + licenseeLastName: ['', [Validators.required,this.noWhitespaceValidator]],
71 licenseTypeId: [1], 71 licenseTypeId: [1],
72 - institutionName: ['', Validators.required],  
73 - address1: ['', Validators.required], 72 + institutionName: ['', [Validators.required,this.noWhitespaceValidator]],
  73 + address1: ['', [Validators.required,this.noWhitespaceValidator]],
74 address2: [''], 74 address2: [''],
75 - city: ['', Validators.required], 75 + city: ['', [Validators.required,this.noWhitespaceValidator]],
76 stateId: [0, Validators.min(1)], 76 stateId: [0, Validators.min(1)],
77 countryId: [0, Validators.min(1)], 77 countryId: [0, Validators.min(1)],
78 - zip: ['', Validators.required],  
79 - emailId: ['', [Validators.email, Validators.required]],  
80 - phone: ['', [Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]], 78 + zip: ['', [Validators.required,this.noWhitespaceValidator]],
  79 + emailId: ['', [Validators.required,this.noWhitespaceValidator]],
  80 + phone: ['', [Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$'),this.noWhitespaceValidator]],
81 editionLoginArr: this.fb.array([]), 81 editionLoginArr: this.fb.array([]),
82 editionLogins: [''], 82 editionLogins: [''],
83 totalLogins: [0], 83 totalLogins: [0],
84 - subscriptionPrice: ['', [Validators.required, Validators.pattern('[0-9.]*')]],  
85 - subscriptionStartDate: ['', Validators.required], 84 + subscriptionPrice: [0, [Validators.required, Validators.pattern('[0-9.]*'),this.noWhitespaceValidator]],
  85 + subscriptionStartDate: [this.startDate, Validators.required],
86 subscriptionEndDate: ['', Validators.required], 86 subscriptionEndDate: ['', Validators.required],
87 - noOfImages: [0, [Validators.required, Validators.pattern('[0-9]*')]],  
88 - masterSiteUrl: ['a', Validators.required], 87 + noOfImages: ['', [Validators.required, Validators.pattern('[0-9]*'),this.noWhitespaceValidator]],
  88 + masterSiteUrl: ['a', [Validators.required,this.noWhitespaceValidator]],
89 siteUrlFrom: [''], 89 siteUrlFrom: [''],
90 siteUrlTo: [''], 90 siteUrlTo: [''],
91 - login: ['a', [Validators.required, Validators.minLength(8)]],  
92 - password: ['a', [Validators.required, Validators.minLength(8)]], 91 + login: ['a', [Validators.required, Validators.minLength(8),this.noWhitespaceValidator]],
  92 + password: ['a', [Validators.required, Validators.minLength(8),this.noWhitespaceValidator]],
93 securityQuestionId: [0, Validators.min(1)], 93 securityQuestionId: [0, Validators.min(1)],
94 - answer: ['a', Validators.required], 94 + answer: ['a', [Validators.required,this.noWhitespaceValidator]],
95 testLicenseEditionId: [1], 95 testLicenseEditionId: [1],
96 creatorId: [this.globalService.loggedInUser.Id], 96 creatorId: [this.globalService.loggedInUser.Id],
97 renew: [false], 97 renew: [false],
98 renewDate: [''], 98 renewDate: [''],
  99 + //renewDate: ['', Validators.required],
99 totalRenewals: [0], 100 totalRenewals: [0],
100 isActive: ['false'] 101 isActive: ['false']
101 }); 102 });
@@ -133,7 +134,76 @@ export class AddLicense implements OnInit { @@ -133,7 +134,76 @@ export class AddLicense implements OnInit {
133 }); 134 });
134 }, error => this.error = <any>error); 135 }, error => this.error = <any>error);
135 } 136 }
  137 + public noWhitespaceValidator(control: FormControl) {
  138 + // new validation for intial whaite space
  139 + //****Birendra *****/
  140 + var isValid=false;
  141 + if(control.value!=null)
  142 + {
  143 + var controlLen=control.value.length;
  144 + if(controlLen==undefined)//undefined for integer value
  145 + {
  146 + isValid=true;
  147 + }
  148 + else if(controlLen!=0)
  149 + {
  150 + const isWhitespace = (control.value || '').trim().length === 0;
  151 + isValid = !isWhitespace;
  152 + if(!isValid)
  153 + {
  154 + control.setValue('');
  155 +
  156 + }
  157 + }
  158 + }
  159 + // can use also on page of input control
  160 + //
  161 + return isValid ? null: { 'whitespace': true };
  162 +
  163 + }
  164 +
  165 + onKeyUp(event: any) {
  166 + var mobno = event.target.value;
  167 + var newnum=mobno;
  168 + if(mobno!="" && event.key!="Backspace")
  169 + {
  170 + var tempArr = mobno.split('-');
  171 +
  172 + if(tempArr.length==1)
  173 + {
  174 + var countdigit=tempArr[0].length;
  175 + newnum=tempArr[0];
  176 + if(countdigit==3)
  177 + {
  178 + newnum=tempArr[0]+"-";
  179 + }
  180 + else if(countdigit>3)
  181 + {
  182 + newnum=tempArr[0].substr(0,3)+"-"+tempArr[0].substr(3,1);
  183 + }
  184 +
  185 + }
  186 + else if(tempArr.length==2)
  187 + {
  188 + newnum=tempArr[0]+"-"+tempArr[1];
  189 + var countdigit=tempArr[1].length;
  190 + if(countdigit==3)
  191 + {
  192 + newnum=tempArr[0]+"-"+tempArr[1]+"-";
  193 + }
  194 + else if(countdigit>3)
  195 + {
  196 + newnum= tempArr[0]+"-"+tempArr[1].substr(0,3)+"-"+tempArr[1].substr(3,1);
  197 + }
  198 + }
  199 + else
  200 + {
  201 + newnum=tempArr[0]+"-"+tempArr[1]+"-"+tempArr[2];
  202 + }
136 203
  204 + }
  205 + this.insertUpdateLicenseFrm.controls['phone'].setValue(newnum);
  206 +};
137 207
138 openModal(template: TemplateRef<any>) { 208 openModal(template: TemplateRef<any>) {
139 this.modalRef = this.modalService.show(template); 209 this.modalRef = this.modalService.show(template);
@@ -157,6 +227,46 @@ export class AddLicense implements OnInit { @@ -157,6 +227,46 @@ export class AddLicense implements OnInit {
157 this.OnLoginBlur(); 227 this.OnLoginBlur();
158 } 228 }
159 229
  230 + // clear alert on check/uncheck renew checkbox
  231 + reNewChange(isChecked: boolean)
  232 + {
  233 + this.alerts = '';
  234 + this.NumberOfRows=0;
  235 + //renew date
  236 + if(isChecked)
  237 + {
  238 + this.insertUpdateLicenseFrm.controls['renewDate'].clearValidators();
  239 + this.insertUpdateLicenseFrm.controls['renewDate'].setValidators(Validators.required);
  240 + }
  241 + else
  242 + {
  243 + this.insertUpdateLicenseFrm.controls['renewDate'].clearValidators();
  244 + }
  245 + this.insertUpdateLicenseFrm.controls['renewDate'].updateValueAndValidity();
  246 +
  247 + if (this.insertUpdateLicenseFrm.controls['licenseTypeId'].value == 2) {
  248 + this.insertUpdateLicenseFrm.controls['editionLoginArr'].value.forEach(element => {
  249 + if(this.NumberOfRows >1)
  250 + {
  251 + this.alerts = "<span>Please select one edition only.</span>";
  252 + }
  253 + else{
  254 + if (element.Checked == 1 && element.Login > 0) {
  255 + this.NumberOfRows+=1
  256 + }
  257 + else if (element.Checked == 1)
  258 + {
  259 + this.NumberOfRows+=1
  260 + }
  261 +
  262 + }
  263 + });
  264 + if(this.totalLogins>1)
  265 + {
  266 + this.alerts += "<br><span>For single license total login can not be more than one.</span>";
  267 + }
  268 + }
  269 + }
160 DateChange(dateValue: any) { 270 DateChange(dateValue: any) {
161 this.alerts = ''; 271 this.alerts = '';
162 this.NumberOfRows=0; 272 this.NumberOfRows=0;
@@ -232,11 +342,7 @@ export class AddLicense implements OnInit { @@ -232,11 +342,7 @@ export class AddLicense implements OnInit {
232 if (Date.parse(this.insertUpdateLicenseFrm.controls['subscriptionStartDate'].value) > 342 if (Date.parse(this.insertUpdateLicenseFrm.controls['subscriptionStartDate'].value) >
233 Date.parse(this.insertUpdateLicenseFrm.controls['subscriptionEndDate'].value)) { 343 Date.parse(this.insertUpdateLicenseFrm.controls['subscriptionEndDate'].value)) {
234 this.alerts += '<span>Subscription start date must be less than the subscription end date</span><br/>'; 344 this.alerts += '<span>Subscription start date must be less than the subscription end date</span><br/>';
235 - }  
236 - // if (Date.parse(this.insertUpdateLicenseFrm.controls['subscriptionStartDate'].value) >  
237 - // Date.parse(this.insertUpdateLicenseFrm.controls['renewDate'].value)) {  
238 - // this.alerts += '<span>Subscription start date must be less than the subscription renew date</span><br/>';  
239 - //} 345 + }
240 } 346 }
241 } 347 }
242 } 348 }
@@ -289,7 +395,7 @@ export class AddLicense implements OnInit { @@ -289,7 +395,7 @@ export class AddLicense implements OnInit {
289 if (this.license.SiteUrlTo == null) { 395 if (this.license.SiteUrlTo == null) {
290 this.license.SiteUrlTo = ''; 396 this.license.SiteUrlTo = '';
291 } 397 }
292 - this.LicenseTypeChanged(this.license.LicenseTypeId); 398 + this.LicenseTypeChanged(this.license.LicenseTypeId,this.license.SubscriptionStartDate);
293 this.insertUpdateLicenseFrm.controls['licenseId'].setValue(this.license.LicenseId); 399 this.insertUpdateLicenseFrm.controls['licenseId'].setValue(this.license.LicenseId);
294 this.insertUpdateLicenseFrm.controls['licenseTypeId'].setValue(this.license.LicenseTypeId); 400 this.insertUpdateLicenseFrm.controls['licenseTypeId'].setValue(this.license.LicenseTypeId);
295 this.insertUpdateLicenseFrm.controls['accountNumber'].setValue(this.license.AccountNumber); 401 this.insertUpdateLicenseFrm.controls['accountNumber'].setValue(this.license.AccountNumber);
@@ -300,7 +406,7 @@ export class AddLicense implements OnInit { @@ -300,7 +406,7 @@ export class AddLicense implements OnInit {
300 this.insertUpdateLicenseFrm.controls['institutionName'].setValue(this.license.InstitutionName); 406 this.insertUpdateLicenseFrm.controls['institutionName'].setValue(this.license.InstitutionName);
301 this.insertUpdateLicenseFrm.controls['address1'].setValue(this.license.Address1); 407 this.insertUpdateLicenseFrm.controls['address1'].setValue(this.license.Address1);
302 this.insertUpdateLicenseFrm.controls['address2'].setValue(this.license.Address2); 408 this.insertUpdateLicenseFrm.controls['address2'].setValue(this.license.Address2);
303 - this.insertUpdateLicenseFrm.controls['city'].setValue(this.license.City); 409 + this.insertUpdateLicenseFrm.controls['city'].setValue(this.license.City);
304 this.insertUpdateLicenseFrm.controls['stateId'].setValue(this.license.StateId); 410 this.insertUpdateLicenseFrm.controls['stateId'].setValue(this.license.StateId);
305 this.insertUpdateLicenseFrm.controls['countryId'].setValue(this.license.CountryId); 411 this.insertUpdateLicenseFrm.controls['countryId'].setValue(this.license.CountryId);
306 this.insertUpdateLicenseFrm.controls['zip'].setValue(this.license.Zip); 412 this.insertUpdateLicenseFrm.controls['zip'].setValue(this.license.Zip);
@@ -310,7 +416,7 @@ export class AddLicense implements OnInit { @@ -310,7 +416,7 @@ export class AddLicense implements OnInit {
310 this.insertUpdateLicenseFrm.controls['subscriptionPrice'].setValue(this.license.Price); 416 this.insertUpdateLicenseFrm.controls['subscriptionPrice'].setValue(this.license.Price);
311 this.insertUpdateLicenseFrm.controls['subscriptionStartDate'].setValue(this.datePipe.transform(this.license.SubscriptionStartDate, 'MM/dd/yyyy')); 417 this.insertUpdateLicenseFrm.controls['subscriptionStartDate'].setValue(this.datePipe.transform(this.license.SubscriptionStartDate, 'MM/dd/yyyy'));
312 this.insertUpdateLicenseFrm.controls['subscriptionEndDate'].setValue(this.datePipe.transform(this.license.SubscriptionEndDate, 'MM/dd/yyyy')); 418 this.insertUpdateLicenseFrm.controls['subscriptionEndDate'].setValue(this.datePipe.transform(this.license.SubscriptionEndDate, 'MM/dd/yyyy'));
313 - this.insertUpdateLicenseFrm.controls['renewDate'].setValue(this.datePipe.transform(this.license.Renewdate, 'MM/dd/yyyy')); 419 + this.insertUpdateLicenseFrm.controls['renewDate'].setValue(this.datePipe.transform(this.license.RenewDate, 'MM/dd/yyyy'));
314 this.insertUpdateLicenseFrm.controls['noOfImages'].setValue(this.license.NoOfImages); 420 this.insertUpdateLicenseFrm.controls['noOfImages'].setValue(this.license.NoOfImages);
315 this.insertUpdateLicenseFrm.controls['masterSiteUrl'].setValue(this.license.MasterSiteUrl); 421 this.insertUpdateLicenseFrm.controls['masterSiteUrl'].setValue(this.license.MasterSiteUrl);
316 this.insertUpdateLicenseFrm.controls['siteUrlFrom'].setValue(this.license.SiteUrlFrom); 422 this.insertUpdateLicenseFrm.controls['siteUrlFrom'].setValue(this.license.SiteUrlFrom);
@@ -329,14 +435,14 @@ export class AddLicense implements OnInit { @@ -329,14 +435,14 @@ export class AddLicense implements OnInit {
329 this.insertUpdateLicenseFrm.controls['isActive'].setValue('false'); 435 this.insertUpdateLicenseFrm.controls['isActive'].setValue('false');
330 } 436 }
331 437
332 - this.insertUpdateLicenseFrm.controls['phone'].clearValidators();  
333 - if (this.lstCountry.find(C => C.Id == this.license.CountryId).CountryName != "United States") {  
334 - this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required]);  
335 - }  
336 - else {  
337 - this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]);  
338 - }  
339 - this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity(); 438 + // this.insertUpdateLicenseFrm.controls['phone'].clearValidators();
  439 + // if (this.lstCountry.find(C => C.Id == this.license.CountryId).CountryName != "United States") {
  440 + // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required,this.noWhitespaceValidator]);
  441 + // }
  442 + // else {
  443 + // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$'),this.noWhitespaceValidator]);
  444 + // }
  445 + // this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity();
340 this.insertUpdateLicenseFrm.controls['phone'].setValue(this.license.Phone); 446 this.insertUpdateLicenseFrm.controls['phone'].setValue(this.license.Phone);
341 447
342 if (this.license.EditionLogins == null) return; 448 if (this.license.EditionLogins == null) return;
@@ -390,9 +496,7 @@ export class AddLicense implements OnInit { @@ -390,9 +496,7 @@ export class AddLicense implements OnInit {
390 else{ 496 else{
391 this._confirmService.activate("License saved successfully.", "alertMsg"); 497 this._confirmService.activate("License saved successfully.", "alertMsg");
392 } 498 }
393 -  
394 - //this.modalAlerts = "<p>License saved successfully.</p>";  
395 - // this.modalRef = this.modalService.show(template); 499 +
396 } 500 }
397 } 501 }
398 502
@@ -401,8 +505,7 @@ export class AddLicense implements OnInit { @@ -401,8 +505,7 @@ export class AddLicense implements OnInit {
401 this.alerts = "<span>License update unsuccessfull.</span>"; 505 this.alerts = "<span>License update unsuccessfull.</span>";
402 } else { 506 } else {
403 this._confirmService.activate("License updated successfully.", "alertMsg"); 507 this._confirmService.activate("License updated successfully.", "alertMsg");
404 - // this.modalAlerts = "<p>License updated successfully.</p>";  
405 - //this.modalRef = this.modalService.show(template); 508 +
406 } 509 }
407 } 510 }
408 511
@@ -471,7 +574,15 @@ export class AddLicense implements OnInit { @@ -471,7 +574,15 @@ export class AddLicense implements OnInit {
471 } 574 }
472 } 575 }
473 576
474 - LicenseTypeChanged(LicenseTypeId: number) { 577 + LicenseTypeChanged(LicenseTypeId: number,startDate: Date) {
  578 +
  579 + var currentDate = new Date();
  580 +
  581 + if(startDate==undefined)
  582 + {
  583 + this.insertUpdateLicenseFrm.controls['subscriptionStartDate'].setValue(currentDate);
  584 +
  585 + }
475 this.totalLogins = 0; 586 this.totalLogins = 0;
476 this.editionLoginsText = ''; 587 this.editionLoginsText = '';
477 this.license.TotalLogins = this.totalLogins; 588 this.license.TotalLogins = this.totalLogins;
@@ -483,6 +594,7 @@ export class AddLicense implements OnInit { @@ -483,6 +594,7 @@ export class AddLicense implements OnInit {
483 this.insertUpdateLicenseFrm.controls['subscriptionPrice'].setValue(''); 594 this.insertUpdateLicenseFrm.controls['subscriptionPrice'].setValue('');
484 this.insertUpdateLicenseFrm.controls['masterSiteUrl'].setValue(''); 595 this.insertUpdateLicenseFrm.controls['masterSiteUrl'].setValue('');
485 this.insertUpdateLicenseFrm.controls['accountNumber'].setValue(''); 596 this.insertUpdateLicenseFrm.controls['accountNumber'].setValue('');
  597 +
486 this.lstEditionLogins = new Array(); 598 this.lstEditionLogins = new Array();
487 this.lstEdition.forEach(element => { 599 this.lstEdition.forEach(element => {
488 this.lstEditionLogins.push({ Id: element.Id, Title: element.Title, Login: 0 }); 600 this.lstEditionLogins.push({ Id: element.Id, Title: element.Title, Login: 0 });
@@ -542,7 +654,7 @@ export class AddLicense implements OnInit { @@ -542,7 +654,7 @@ export class AddLicense implements OnInit {
542 if (this.insertUpdateLicenseFrm.controls['renew'].value == true){ 654 if (this.insertUpdateLicenseFrm.controls['renew'].value == true){
543 if (Date.parse(this.insertUpdateLicenseFrm.controls['subscriptionStartDate'].value) < 655 if (Date.parse(this.insertUpdateLicenseFrm.controls['subscriptionStartDate'].value) <
544 Date.parse(this.license.SubscriptionEndDate.toString())) { 656 Date.parse(this.license.SubscriptionEndDate.toString())) {
545 - this.alerts += '<span>The new subscription start date should be greater than the previous subscription end date</span>'; 657 + this.alerts += '<span>The new subscription start date should be greater than the previous subscription end date('+this.datePipe.transform(this.license.SubscriptionEndDate, 'MM/dd/yyyy')+')</span>';
546 } 658 }
547 } 659 }
548 this.editionLoginsText = ''; 660 this.editionLoginsText = '';
@@ -552,8 +664,7 @@ export class AddLicense implements OnInit { @@ -552,8 +664,7 @@ export class AddLicense implements OnInit {
552 this.editionLoginsText += element.Id.toString() + '-' + element.Login + '|'; 664 this.editionLoginsText += element.Id.toString() + '-' + element.Login + '|';
553 } 665 }
554 }); 666 });
555 - }  
556 - 667 + }
557 else { 668 else {
558 this.insertUpdateLicenseFrm.controls['editionLoginArr'].value.forEach(element => { 669 this.insertUpdateLicenseFrm.controls['editionLoginArr'].value.forEach(element => {
559 if (element.Login > 0) { 670 if (element.Login > 0) {
@@ -612,16 +723,16 @@ export class AddLicense implements OnInit { @@ -612,16 +723,16 @@ export class AddLicense implements OnInit {
612 if (this.lstCountry.find(C => C.Id == this.license.CountryId).CountryName != "United States") { 723 if (this.lstCountry.find(C => C.Id == this.license.CountryId).CountryName != "United States") {
613 this.license.StateId = this.lstState.find(C => C.StateName == "Other").Id; 724 this.license.StateId = this.lstState.find(C => C.StateName == "Other").Id;
614 this.insertUpdateLicenseFrm.controls['stateId'].setValue(this.license.StateId); 725 this.insertUpdateLicenseFrm.controls['stateId'].setValue(this.license.StateId);
615 - this.insertUpdateLicenseFrm.controls['phone'].clearValidators();  
616 - this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required]); 726 + // this.insertUpdateLicenseFrm.controls['phone'].clearValidators();
  727 + // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required,this.noWhitespaceValidator]);
617 } 728 }
618 else { 729 else {
619 this.license.StateId = 0; 730 this.license.StateId = 0;
620 this.insertUpdateLicenseFrm.controls['stateId'].setValue(this.license.StateId); 731 this.insertUpdateLicenseFrm.controls['stateId'].setValue(this.license.StateId);
621 - this.insertUpdateLicenseFrm.controls['phone'].clearValidators();  
622 - this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]); 732 + // this.insertUpdateLicenseFrm.controls['phone'].clearValidators();
  733 + // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$'),this.noWhitespaceValidator]);
623 } 734 }
624 - this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity(); 735 + //this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity();
625 } 736 }
626 737
627 OnStateChange(element: any) { 738 OnStateChange(element: any) {
@@ -629,16 +740,16 @@ export class AddLicense implements OnInit { @@ -629,16 +740,16 @@ export class AddLicense implements OnInit {
629 if (this.lstState.find(C => C.Id == this.license.StateId).StateName != "Other") { 740 if (this.lstState.find(C => C.Id == this.license.StateId).StateName != "Other") {
630 this.license.CountryId = this.lstCountry.find(C => C.CountryName == "United States").Id; 741 this.license.CountryId = this.lstCountry.find(C => C.CountryName == "United States").Id;
631 this.insertUpdateLicenseFrm.controls['countryId'].setValue(this.license.CountryId); 742 this.insertUpdateLicenseFrm.controls['countryId'].setValue(this.license.CountryId);
632 - this.insertUpdateLicenseFrm.controls['phone'].clearValidators();  
633 - this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]); 743 + // this.insertUpdateLicenseFrm.controls['phone'].clearValidators();
  744 + // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$'),this.noWhitespaceValidator]);
634 } 745 }
635 else { 746 else {
636 this.license.CountryId = 0; 747 this.license.CountryId = 0;
637 this.insertUpdateLicenseFrm.controls['countryId'].setValue(this.license.CountryId); 748 this.insertUpdateLicenseFrm.controls['countryId'].setValue(this.license.CountryId);
638 - this.insertUpdateLicenseFrm.controls['phone'].clearValidators();  
639 - this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required]); 749 + // this.insertUpdateLicenseFrm.controls['phone'].clearValidators();
  750 + // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required,this.noWhitespaceValidator]);
640 } 751 }
641 - this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity(); 752 + // this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity();
642 } 753 }
643 754
644 SubscriptionPriceBlur() { 755 SubscriptionPriceBlur() {
400-SOURCECODE/Admin/src/app/components/LicenseEntity/editlicensebasicsettings.component.html
@@ -97,9 +97,9 @@ @@ -97,9 +97,9 @@
97 <div class="form-group"> 97 <div class="form-group">
98 <label for="inputEmail3" class="col-sm-4 control-label">Email ID <span class="red">*</span> :</label> 98 <label for="inputEmail3" class="col-sm-4 control-label">Email ID <span class="red">*</span> :</label>
99 <div class="col-sm-7"> 99 <div class="col-sm-7">
100 - <input type="email" class="form-control input-sm" id="Email" formControlName="emailId" maxlength="50">  
101 - <div *ngIf="updateLicenseBasicSettingsFrm.controls.emailId.hasError('required') && updateLicenseBasicSettingsFrm.controls.emailId.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Email is required</div>  
102 - <div *ngIf="updateLicenseBasicSettingsFrm.controls.emailId.hasError('email') && updateLicenseBasicSettingsFrm.controls.emailId.value != '' && updateLicenseBasicSettingsFrm.controls.emailId.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Email is invalid</div> 100 + <input type="text" class="form-control input-sm" id="Email" formControlName="emailId" maxlength="50" pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,3}$">
  101 + <div *ngIf="updateLicenseBasicSettingsFrm.controls.emailId.hasError('required') && !updateLicenseBasicSettingsFrm.controls.emailId.value && updateLicenseBasicSettingsFrm.controls.emailId.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Email is required</div>
  102 + <div *ngIf="updateLicenseBasicSettingsFrm.controls.emailId.invalid && updateLicenseBasicSettingsFrm.controls.emailId.value" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Email is invalid</div>
103 </div> 103 </div>
104 </div> 104 </div>
105 105
@@ -161,7 +161,7 @@ @@ -161,7 +161,7 @@
161 <div class="form-group"> 161 <div class="form-group">
162 <label for="inputEmail3" class="col-sm-4 control-label">Phone <span class="red">*</span> :</label> 162 <label for="inputEmail3" class="col-sm-4 control-label">Phone <span class="red">*</span> :</label>
163 <div class="col-sm-7"> 163 <div class="col-sm-7">
164 - <input type="text" class="form-control input-sm" id="Phone" formControlName="phone" maxlength="30"> 164 + <input type="text" class="form-control input-sm" id="Phone" formControlName="phone" maxlength="30" (keyup)="onKeyUp($event)">
165 <span class="help-block">(xxx-xxx-xxxx)</span> 165 <span class="help-block">(xxx-xxx-xxxx)</span>
166 <div *ngIf="updateLicenseBasicSettingsFrm.controls.phone.hasError('required') && updateLicenseBasicSettingsFrm.controls.phone.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Phone is required</div> 166 <div *ngIf="updateLicenseBasicSettingsFrm.controls.phone.hasError('required') && updateLicenseBasicSettingsFrm.controls.phone.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Phone is required</div>
167 <div *ngIf="updateLicenseBasicSettingsFrm.controls.phone.hasError('pattern') && updateLicenseBasicSettingsFrm.controls.phone.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Phone is invalid</div> 167 <div *ngIf="updateLicenseBasicSettingsFrm.controls.phone.hasError('pattern') && updateLicenseBasicSettingsFrm.controls.phone.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Phone is invalid</div>
400-SOURCECODE/Admin/src/app/components/LicenseEntity/editlicensebasicsettings.component.ts
@@ -48,23 +48,93 @@ export class EditLicenseBasicSettings implements OnInit { @@ -48,23 +48,93 @@ export class EditLicenseBasicSettings implements OnInit {
48 this.lastScrollPos = 0; 48 this.lastScrollPos = 0;
49 this.updateLicenseBasicSettingsFrm = this.fb.group({ 49 this.updateLicenseBasicSettingsFrm = this.fb.group({
50 licenseId: [0], 50 licenseId: [0],
51 - accountNumber: ['', Validators.required],  
52 - licenseeFirstName: ['', Validators.required],  
53 - licenseeLastName: ['', Validators.required],  
54 - institutionName: ['', Validators.required],  
55 - address1: ['', Validators.required], 51 + accountNumber: ['', [Validators.required,this.noWhitespaceValidator]],
  52 + licenseeFirstName: ['', [Validators.required,this.noWhitespaceValidator]],
  53 + licenseeLastName: ['', [Validators.required,this.noWhitespaceValidator]],
  54 + institutionName: ['', [Validators.required,this.noWhitespaceValidator]],
  55 + address1: ['', [Validators.required,this.noWhitespaceValidator]],
56 address2: [''], 56 address2: [''],
57 - city: ['', Validators.required], 57 + city: ['', [Validators.required,this.noWhitespaceValidator]],
58 stateId: [0], 58 stateId: [0],
59 countryId: [0], 59 countryId: [0],
60 - zip: ['', Validators.required],  
61 - emailId: ['', [Validators.required, Validators.email]],  
62 - phone: ['', [Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]], 60 + zip: ['', [Validators.required,this.noWhitespaceValidator]],
  61 + emailId: ['', [Validators.required,this.noWhitespaceValidator]],
  62 + phone: ['', [Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$'),this.noWhitespaceValidator]],
63 }); 63 });
64 this.GetCountry(); 64 this.GetCountry();
65 this.GetState(); 65 this.GetState();
66 this.GetLicenseAccounts(); 66 this.GetLicenseAccounts();
67 } 67 }
  68 + public noWhitespaceValidator(control: FormControl) {
  69 + // new validation for intial whaite space
  70 + //****Birendra *****/
  71 + var isValid=false;
  72 + if(control.value!=null)
  73 + {
  74 + var controlLen=control.value.length;
  75 + if(controlLen==undefined)//undefined for integer value
  76 + {
  77 + isValid=true;
  78 + }
  79 + else if(controlLen!=0)
  80 + {
  81 + const isWhitespace = (control.value || '').trim().length === 0;
  82 + isValid = !isWhitespace;
  83 + if(!isValid)
  84 + {
  85 + control.setValue('');
  86 +
  87 + }
  88 + }
  89 + }
  90 + // can use also on page of input control
  91 + //
  92 + return isValid ? null: { 'whitespace': true };
  93 +
  94 + }
  95 + onKeyUp(event: any) {
  96 + var mobno = event.target.value;
  97 + var newnum=mobno;
  98 + if(mobno!="" && event.key!="Backspace")
  99 + {
  100 + var tempArr = mobno.split('-');
  101 +
  102 + if(tempArr.length==1)
  103 + {
  104 + var countdigit=tempArr[0].length;
  105 + newnum=tempArr[0];
  106 + if(countdigit==3)
  107 + {
  108 + newnum=tempArr[0]+"-";
  109 + }
  110 + else if(countdigit>3)
  111 + {
  112 + newnum=tempArr[0].substr(0,3)+"-"+tempArr[0].substr(3,1);
  113 + }
  114 +
  115 + }
  116 + else if(tempArr.length==2)
  117 + {
  118 + newnum=tempArr[0]+"-"+tempArr[1];
  119 + var countdigit=tempArr[1].length;
  120 + if(countdigit==3)
  121 + {
  122 + newnum=tempArr[0]+"-"+tempArr[1]+"-";
  123 + }
  124 + else if(countdigit>3)
  125 + {
  126 + newnum= tempArr[0]+"-"+tempArr[1].substr(0,3)+"-"+tempArr[1].substr(3,1);
  127 + }
  128 + }
  129 + else
  130 + {
  131 + newnum=tempArr[0]+"-"+tempArr[1]+"-"+tempArr[2];
  132 + }
  133 +
  134 + }
  135 + this.updateLicenseBasicSettingsFrm.controls['phone'].setValue(newnum);
  136 +
  137 +};
68 138
69 openModal(template: TemplateRef<any>) { 139 openModal(template: TemplateRef<any>) {
70 this.modalRef = this.modalService.show(template); 140 this.modalRef = this.modalService.show(template);
400-SOURCECODE/Admin/src/app/components/LicenseEntity/searchlicense.component.ts
@@ -177,7 +177,7 @@ export class SearchLicense implements OnInit, AfterViewChecked { @@ -177,7 +177,7 @@ export class SearchLicense implements OnInit, AfterViewChecked {
177 this.license = this.licenses[0]; 177 this.license = this.licenses[0];
178 this.searchLicenseFrm.setControl('licenses', this.fb.array(this.licenses)); 178 this.searchLicenseFrm.setControl('licenses', this.fb.array(this.licenses));
179 if(this.selectedId > -1){ 179 if(this.selectedId > -1){
180 - this.license = this.searchLicenseFrm.controls['licenses'].value.find(C => C.LicenseId = this.selectedId); 180 + this.license = this.searchLicenseFrm.controls['licenses'].value.find(C => C.LicenseId == this.selectedId);
181 } 181 }
182 if (this.licenses.length > 0) { 182 if (this.licenses.length > 0) {
183 this.NoRecord = ''; 183 this.NoRecord = '';
400-SOURCECODE/Admin/src/app/components/LicenseEntity/sitelicenseaccount.component.html
@@ -336,7 +336,7 @@ @@ -336,7 +336,7 @@
336 <label for="Phone" class="col-sm-12 col-lg-6 control-label text-right-lg paddTop7 padd-left0">Phone <span class="red">*</span> :</label> 336 <label for="Phone" class="col-sm-12 col-lg-6 control-label text-right-lg paddTop7 padd-left0">Phone <span class="red">*</span> :</label>
337 </div> 337 </div>
338 <div class="col-sm-12 col-lg-6 padd-left0 padd-right0"> 338 <div class="col-sm-12 col-lg-6 padd-left0 padd-right0">
339 - <input type="phone" class="form-control input-sm" id="Phone" formControlName="phone" maxlength="30"> 339 + <input type="phone" class="form-control input-sm" id="Phone" formControlName="phone" maxlength="30" (keyup)="onKeyUp($event)">
340 <!--<div *ngIf="insertUpdateSiteLicenseFrm.controls.phone.hasError('required') && insertUpdateSiteLicenseFrm.controls.phone.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Phone is required</div>--> 340 <!--<div *ngIf="insertUpdateSiteLicenseFrm.controls.phone.hasError('required') && insertUpdateSiteLicenseFrm.controls.phone.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Phone is required</div>-->
341 <span class="help-block">(xxx-xxx-xxxx)</span> 341 <span class="help-block">(xxx-xxx-xxxx)</span>
342 <div *ngIf="insertUpdateSiteLicenseFrm.controls.phone.hasError('required') && insertUpdateSiteLicenseFrm.controls.phone.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Phone is required</div> 342 <div *ngIf="insertUpdateSiteLicenseFrm.controls.phone.hasError('required') && insertUpdateSiteLicenseFrm.controls.phone.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Phone is required</div>
@@ -362,7 +362,7 @@ @@ -362,7 +362,7 @@
362 <div class="form-group marginTop5"> 362 <div class="form-group marginTop5">
363 <label for="ClientAdminEmail" class="col-sm-12 col-lg-6 control-label text-right-lg paddTop7 padd-left0">Client Admin Email ID :</label> 363 <label for="ClientAdminEmail" class="col-sm-12 col-lg-6 control-label text-right-lg paddTop7 padd-left0">Client Admin Email ID :</label>
364 <div class="col-sm-12 col-lg-6 padd-left0 padd-right0"> 364 <div class="col-sm-12 col-lg-6 padd-left0 padd-right0">
365 - <input type="email" class="form-control input-sm" id="ClientAdminEmail" formControlName="clientAdminEmail" maxlength="50"> 365 + <input type="text" class="form-control input-sm" id="ClientAdminEmail" formControlName="clientAdminEmail" maxlength="50" pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,3}$">
366 </div> 366 </div>
367 </div> 367 </div>
368 </div> 368 </div>
400-SOURCECODE/Admin/src/app/components/LicenseEntity/sitelicenseaccount.component.ts
@@ -63,22 +63,22 @@ export class SiteLicenseAccount implements OnInit { @@ -63,22 +63,22 @@ export class SiteLicenseAccount implements OnInit {
63 licenseId: [0], 63 licenseId: [0],
64 accountNumber: [{value: '', disabled: true}], 64 accountNumber: [{value: '', disabled: true}],
65 siteId: [0], 65 siteId: [0],
66 - siteUrl: ['', Validators.required], 66 + siteUrl: ['', [Validators.required,this.noWhitespaceValidator]],
67 siteUrlTo: [''], 67 siteUrlTo: [''],
68 siteMasterUrlTo: [''], 68 siteMasterUrlTo: [''],
69 buildAccName: [''], 69 buildAccName: [''],
70 - institutionName: ['', Validators.required], 70 + institutionName: ['', [Validators.required,this.noWhitespaceValidator]],
71 departmentName: [''], 71 departmentName: [''],
72 - address1: ['', Validators.required], 72 + address1: ['', [Validators.required,this.noWhitespaceValidator]],
73 address2: [''], 73 address2: [''],
74 - city: ['', Validators.required], 74 + city: ['', [Validators.required,this.noWhitespaceValidator]],
75 countryId: [0, Validators.min(1)], 75 countryId: [0, Validators.min(1)],
76 stateId: [0, Validators.min(1)], 76 stateId: [0, Validators.min(1)],
77 - zip: ['', Validators.required],  
78 - phone: ['', [Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]], 77 + zip: ['', [Validators.required,this.noWhitespaceValidator]],
  78 + phone: ['', [Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$'),this.noWhitespaceValidator]],
79 //phone: ['', Validators.required], 79 //phone: ['', Validators.required],
80 clientAdminId: [0, Validators.min(1)], 80 clientAdminId: [0, Validators.min(1)],
81 - clientAdminEmail: [{value: '', disabled: true}, Validators.email], 81 + clientAdminEmail: [{value: '', disabled: true}, this.noWhitespaceValidator],
82 isActive: [0], 82 isActive: [0],
83 isMaster: [0], 83 isMaster: [0],
84 creationDate: [''], 84 creationDate: [''],
@@ -123,6 +123,75 @@ export class SiteLicenseAccount implements OnInit { @@ -123,6 +123,75 @@ export class SiteLicenseAccount implements OnInit {
123 document.body.appendChild(testScript); 123 document.body.appendChild(testScript);
124 } 124 }
125 } 125 }
  126 + public noWhitespaceValidator(control: FormControl) {
  127 + // new validation for intial whaite space
  128 + //****Birendra *****/
  129 + var isValid=false;
  130 + if(control.value!=null)
  131 + {
  132 + var controlLen=control.value.length;
  133 + if(controlLen==undefined)//undefined for integer value
  134 + {
  135 + isValid=true;
  136 + }
  137 + else if(controlLen!=0)
  138 + {
  139 + const isWhitespace = (control.value || '').trim().length === 0;
  140 + isValid = !isWhitespace;
  141 + if(!isValid)
  142 + {
  143 + control.setValue('');
  144 +
  145 + }
  146 + }
  147 + }
  148 + // can use also on page of input control
  149 + //
  150 + return isValid ? null: { 'whitespace': true };
  151 +
  152 + }
  153 + onKeyUp(event: any) {
  154 + var mobno = event.target.value;
  155 + var newnum=mobno;
  156 + if(mobno!="" && event.key!="Backspace")
  157 + {
  158 + var tempArr = mobno.split('-');
  159 +
  160 + if(tempArr.length==1)
  161 + {
  162 + var countdigit=tempArr[0].length;
  163 + newnum=tempArr[0];
  164 + if(countdigit==3)
  165 + {
  166 + newnum=tempArr[0]+"-";
  167 + }
  168 + else if(countdigit>3)
  169 + {
  170 + newnum=tempArr[0].substr(0,3)+"-"+tempArr[0].substr(3,1);
  171 + }
  172 +
  173 + }
  174 + else if(tempArr.length==2)
  175 + {
  176 + newnum=tempArr[0]+"-"+tempArr[1];
  177 + var countdigit=tempArr[1].length;
  178 + if(countdigit==3)
  179 + {
  180 + newnum=tempArr[0]+"-"+tempArr[1]+"-";
  181 + }
  182 + else if(countdigit>3)
  183 + {
  184 + newnum= tempArr[0]+"-"+tempArr[1].substr(0,3)+"-"+tempArr[1].substr(3,1);
  185 + }
  186 + }
  187 + else
  188 + {
  189 + newnum=tempArr[0]+"-"+tempArr[1]+"-"+tempArr[2];
  190 + }
  191 +
  192 + }
  193 + this.insertUpdateSiteLicenseFrm.controls['phone'].setValue(newnum);
  194 + };
126 195
127 openModal(template: TemplateRef<any>) { 196 openModal(template: TemplateRef<any>) {
128 this.modalRef = this.modalService.show(template); 197 this.modalRef = this.modalService.show(template);
@@ -428,46 +497,38 @@ export class SiteLicenseAccount implements OnInit { @@ -428,46 +497,38 @@ export class SiteLicenseAccount implements OnInit {
428 this.insertUpdateSiteLicenseFrm.controls['clientAdminEmail'].setValue(''); 497 this.insertUpdateSiteLicenseFrm.controls['clientAdminEmail'].setValue('');
429 } 498 }
430 OnCountryChange(element: any) { 499 OnCountryChange(element: any) {
431 - if (element.innerText != '') {  
432 -  
433 - }  
434 - else {  
435 this.license.CountryId = parseInt(element.value); 500 this.license.CountryId = parseInt(element.value);
436 if (this.lstCountry.find(C => C.Id == this.license.CountryId).CountryName != "United States") { 501 if (this.lstCountry.find(C => C.Id == this.license.CountryId).CountryName != "United States") {
437 this.license.StateId = this.lstState.find(C => C.StateName == "Other").Id; 502 this.license.StateId = this.lstState.find(C => C.StateName == "Other").Id;
438 this.insertUpdateSiteLicenseFrm.controls['stateId'].setValue(this.license.StateId); 503 this.insertUpdateSiteLicenseFrm.controls['stateId'].setValue(this.license.StateId);
439 - this.insertUpdateSiteLicenseFrm.controls['phone'].clearValidators();  
440 - this.insertUpdateSiteLicenseFrm.controls['phone'].setValidators([Validators.required]); 504 + // this.insertUpdateSiteLicenseFrm.controls['phone'].clearValidators();
  505 + // this.insertUpdateSiteLicenseFrm.controls['phone'].setValidators([Validators.required,this.noWhitespaceValidator]);
441 } 506 }
442 else { 507 else {
443 this.license.StateId = 0; 508 this.license.StateId = 0;
444 this.insertUpdateSiteLicenseFrm.controls['stateId'].setValue(this.license.StateId); 509 this.insertUpdateSiteLicenseFrm.controls['stateId'].setValue(this.license.StateId);
445 - this.insertUpdateSiteLicenseFrm.controls['phone'].clearValidators();  
446 - this.insertUpdateSiteLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]); 510 + // this.insertUpdateSiteLicenseFrm.controls['phone'].clearValidators();
  511 + // this.insertUpdateSiteLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$'),this.noWhitespaceValidator]);
447 } 512 }
448 - this.insertUpdateSiteLicenseFrm.controls['phone'].updateValueAndValidity();  
449 - } 513 + // this.insertUpdateSiteLicenseFrm.controls['phone'].updateValueAndValidity();
  514 +
450 } 515 }
451 OnStateChange(element: any) { 516 OnStateChange(element: any) {
452 - if (element.innerText != '') {  
453 -  
454 - }  
455 - else {  
456 this.license.StateId = parseInt(element.value); 517 this.license.StateId = parseInt(element.value);
457 if (this.lstState.find(C => C.Id == this.license.StateId).StateName != "Other") { 518 if (this.lstState.find(C => C.Id == this.license.StateId).StateName != "Other") {
458 this.license.CountryId = this.lstCountry.find(C => C.CountryName == "United States").Id; 519 this.license.CountryId = this.lstCountry.find(C => C.CountryName == "United States").Id;
459 this.insertUpdateSiteLicenseFrm.controls['countryId'].setValue(this.license.CountryId); 520 this.insertUpdateSiteLicenseFrm.controls['countryId'].setValue(this.license.CountryId);
460 - this.insertUpdateSiteLicenseFrm.controls['phone'].clearValidators();  
461 - this.insertUpdateSiteLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]); 521 + // this.insertUpdateSiteLicenseFrm.controls['phone'].clearValidators();
  522 + // this.insertUpdateSiteLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$'),this.noWhitespaceValidator]);
462 } 523 }
463 else { 524 else {
464 this.license.CountryId = 0; 525 this.license.CountryId = 0;
465 this.insertUpdateSiteLicenseFrm.controls['countryId'].setValue(this.license.CountryId); 526 this.insertUpdateSiteLicenseFrm.controls['countryId'].setValue(this.license.CountryId);
466 - this.insertUpdateSiteLicenseFrm.controls['phone'].clearValidators();  
467 - this.insertUpdateSiteLicenseFrm.controls['phone'].setValidators([Validators.required]); 527 + // this.insertUpdateSiteLicenseFrm.controls['phone'].clearValidators();
  528 + // this.insertUpdateSiteLicenseFrm.controls['phone'].setValidators([Validators.required,this.noWhitespaceValidator]);
468 } 529 }
469 - this.insertUpdateSiteLicenseFrm.controls['phone'].updateValueAndValidity();  
470 - } 530 + // this.insertUpdateSiteLicenseFrm.controls['phone'].updateValueAndValidity();
  531 +
471 } 532 }
472 533
473 EditLicenseSite(){ 534 EditLicenseSite(){
400-SOURCECODE/Admin/src/app/components/SubscriptionPrice/subscriptionprice.component.ts
@@ -55,9 +55,9 @@ RecordDeleted: number[]; @@ -55,9 +55,9 @@ RecordDeleted: number[];
55 }); 55 });
56 this.insertSubscriptionPriceFrm = this.fb.group({ 56 this.insertSubscriptionPriceFrm = this.fb.group({
57 subscriptionPriceId: [''], 57 subscriptionPriceId: [''],
58 - title: ['', Validators.required],  
59 - price: ['', [Validators.required, Validators.pattern('[0-9.]*')]],  
60 - duration: ['', [Validators.required, Validators.pattern('[0-9]*')]], 58 + title: ['', [Validators.required,this.noWhitespaceValidator]],
  59 + price: ['', [Validators.required, Validators.pattern('[0-9.]*'),this.noWhitespaceValidator]],
  60 + duration: ['', [Validators.required, Validators.pattern('[0-9]*'),this.noWhitespaceValidator]],
61 editionId: [''], 61 editionId: [''],
62 isActive: ['false'] 62 isActive: ['false']
63 }); 63 });
@@ -91,6 +91,33 @@ RecordDeleted: number[]; @@ -91,6 +91,33 @@ RecordDeleted: number[];
91 document.body.appendChild(testScript); 91 document.body.appendChild(testScript);
92 } 92 }
93 } 93 }
  94 + public noWhitespaceValidator(control: FormControl) {
  95 + // new validation for intial whaite space
  96 + //****Birendra *****/
  97 + var isValid=false;
  98 + if(control.value!=null)
  99 + {
  100 + var controlLen=control.value.length;
  101 + if(controlLen==undefined)//undefined for integer value
  102 + {
  103 + isValid=true;
  104 + }
  105 + else if(controlLen!=0)
  106 + {
  107 + const isWhitespace = (control.value || '').trim().length === 0;
  108 + isValid = !isWhitespace;
  109 + if(!isValid)
  110 + {
  111 + control.setValue('');
  112 +
  113 + }
  114 + }
  115 + }
  116 + // can use also on page of input control
  117 + //
  118 + return isValid ? null: { 'whitespace': true };
  119 +
  120 + }
94 121
95 public SearchSubscriptionPrices(evt: any) { 122 public SearchSubscriptionPrices(evt: any) {
96 if (this.global.ValidationMsg != '') { 123 if (this.global.ValidationMsg != '') {
400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.html
@@ -71,6 +71,7 @@ @@ -71,6 +71,7 @@
71 <div *ngIf="!adduserFrm.controls.LastName.valid && adduserFrm.controls.LastName.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Last Name is required</div> 71 <div *ngIf="!adduserFrm.controls.LastName.valid && adduserFrm.controls.LastName.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Last Name is required</div>
72 </div> 72 </div>
73 </div> 73 </div>
  74 + <div *ngIf="this.router.url == '/adduser'">
74 <div class="form-group" #accountNo *ngIf="this.commonService.UserType == 1 || this.commonService.UserType == 2"> 75 <div class="form-group" #accountNo *ngIf="this.commonService.UserType == 1 || this.commonService.UserType == 2">
75 <label for="inputEmail3" class="col-sm-4 control-label">Account Number <span class="red">*</span> :</label> 76 <label for="inputEmail3" class="col-sm-4 control-label">Account Number <span class="red">*</span> :</label>
76 <div class="col-sm-7" dropdown (isOpenChange)="onOpenChange($event)" (keyup)="onKeyPress($event)" [dropup]="isDropup"> 77 <div class="col-sm-7" dropdown (isOpenChange)="onOpenChange($event)" (keyup)="onKeyPress($event)" [dropup]="isDropup">
@@ -89,6 +90,7 @@ @@ -89,6 +90,7 @@
89 </ul> 90 </ul>
90 </div> 91 </div>
91 </div> 92 </div>
  93 +
92 <div class="form-group" #accountNo *ngIf="this.commonService.UserType > 2"> 94 <div class="form-group" #accountNo *ngIf="this.commonService.UserType > 2">
93 <label for="inputEmail3" class="col-sm-4 control-label">Account Number <span class="red">*</span> :</label> 95 <label for="inputEmail3" class="col-sm-4 control-label">Account Number <span class="red">*</span> :</label>
94 <div class="col-sm-7" dropdown (isOpenChange)="onOpenChange($event)" (keyup)="onKeyPress($event)" [dropup]="isDropup"> 96 <div class="col-sm-7" dropdown (isOpenChange)="onOpenChange($event)" (keyup)="onKeyPress($event)" [dropup]="isDropup">
@@ -116,6 +118,7 @@ @@ -116,6 +118,7 @@
116 </select> 118 </select>
117 </div> 119 </div>
118 </div> 120 </div>
  121 + </div>
119 <div class="row"> 122 <div class="row">
120 <div class="col-sm-12 marginTop20 text-center"> 123 <div class="col-sm-12 marginTop20 text-center">
121 <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" (click)="AddUser()"><i class="fa fa-plus-circle"></i> Add</button> 124 <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" (click)="AddUser()"><i class="fa fa-plus-circle"></i> Add</button>
400-SOURCECODE/Admin/src/app/components/UserEntity/adduser.component.ts
@@ -60,29 +60,65 @@ export class AddUser implements OnInit, AfterViewInit { @@ -60,29 +60,65 @@ export class AddUser implements OnInit, AfterViewInit {
60 //this.userservice.GetUserById(this.UserId); 60 //this.userservice.GetUserById(this.UserId);
61 this.adduserFrm = this.fb.group({ 61 this.adduserFrm = this.fb.group({
62 id: [''], 62 id: [''],
63 - UserName: ['', [Validators.required, Validators.minLength(8)]],  
64 - Password: ['', [Validators.required, Validators.minLength(8)]],  
65 - ConfirmPassword: ['', Validators.required],  
66 - FirstName: ['', Validators.required],  
67 - LastName: ['', Validators.required],  
68 - EmailId: ['', Validators.required], 63 + UserName: ['', [Validators.required, Validators.minLength(8),this.noWhitespaceValidator]],
  64 + Password: ['', [Validators.required, Validators.minLength(8),this.noWhitespaceValidator]],
  65 + ConfirmPassword: ['', [Validators.required,this.noWhitespaceValidator]],
  66 + FirstName: ['', [Validators.required,this.noWhitespaceValidator]],
  67 + LastName: ['', [Validators.required,this.noWhitespaceValidator]],
  68 + EmailId: ['', [Validators.required,this.noWhitespaceValidator]],
69 AccountNumberId: ['', Validators.required], 69 AccountNumberId: ['', Validators.required],
70 UserTypeId: ['', Validators.required], 70 UserTypeId: ['', Validators.required],
71 ProductEditionId: ['', Validators.required] 71 ProductEditionId: ['', Validators.required]
72 }); 72 });
73 73
74 this._loadingService.ShowLoading("global-loading"); 74 this._loadingService.ShowLoading("global-loading");
75 - this.bindUsers();  
76 - this.GetAccountNumber();  
77 - //this.GetUserTypeByLicenseId();  
78 - 75 + this.bindUsers(0);
  76 + if(this.router.url === '/adduser')
  77 + {
  78 + this.GetAccountNumber();
  79 + }
  80 + else{
  81 + this._loadingService.HideLoading("global-loading");
  82 + }
  83 +
79 } 84 }
80 ngAfterViewInit() { 85 ngAfterViewInit() {
81 - this.CheckDropDownOrUp(this.accountNodiv.nativeElement); 86 + if(this.router.url === '/adduser')
  87 + {
  88 + this.CheckDropDownOrUp(this.accountNodiv.nativeElement);
  89 + }
  90 +
82 } 91 }
83 redirect() { 92 redirect() {
84 this.router.navigate(['/']); 93 this.router.navigate(['/']);
85 } 94 }
  95 + public noWhitespaceValidator(control: FormControl) {
  96 + // new validation for intial whaite space
  97 + //****Birendra *****/
  98 + var isValid=false;
  99 + if(control.value!=null)
  100 + {
  101 + var controlLen=control.value.length;
  102 + if(controlLen==undefined)//undefined for integer value
  103 + {
  104 + isValid=true;
  105 + }
  106 + else if(controlLen!=0)
  107 + {
  108 + const isWhitespace = (control.value || '').trim().length === 0;
  109 + isValid = !isWhitespace;
  110 + if(!isValid)
  111 + {
  112 + control.setValue('');
  113 +
  114 + }
  115 + }
  116 + }
  117 + // can use also on page of input control
  118 + //
  119 + return isValid ? null: { 'whitespace': true };
  120 +
  121 + }
86 GetUserTypeByLicenseId() { 122 GetUserTypeByLicenseId() {
87 var Accountnumber = this.adduserFrm.controls['AccountNumberId'].value; 123 var Accountnumber = this.adduserFrm.controls['AccountNumberId'].value;
88 if (Accountnumber == "") { Accountnumber = 0 } 124 if (Accountnumber == "") { Accountnumber = 0 }
@@ -222,16 +258,19 @@ export class AddUser implements OnInit, AfterViewInit { @@ -222,16 +258,19 @@ export class AddUser implements OnInit, AfterViewInit {
222 this.alerts += '</br><span>Last Name is required.</span>'; 258 this.alerts += '</br><span>Last Name is required.</span>';
223 } 259 }
224 260
225 -  
226 - if (this.adduserFrm.value.AccountNumberId == '0') {  
227 - this.alerts += '</br><span>Please select account number</span>';  
228 - }  
229 - if (this.adduserFrm.value.UserTypeId == '0') {  
230 - this.alerts += '</br><span>Please select user type</span>';  
231 - }  
232 - if (this.adduserFrm.value.ProductEditionId == '0') {  
233 - this.alerts += '</br><span>Please select product edition</span>';  
234 - } 261 + if(this.router.url === '/adduser')
  262 + {
  263 + if (this.adduserFrm.value.AccountNumberId == '0') {
  264 + this.alerts += '</br><span>Please select account number</span>';
  265 + }
  266 + if (this.adduserFrm.value.UserTypeId == '0') {
  267 + this.alerts += '</br><span>Please select user type</span>';
  268 + }
  269 + if (this.adduserFrm.value.ProductEditionId == '0') {
  270 + this.alerts += '</br><span>Please select product edition</span>';
  271 + }
  272 + }
  273 +
235 if (this.alerts == '') { 274 if (this.alerts == '') {
236 var AddUserEntity = this.adduserFrm.value; 275 var AddUserEntity = this.adduserFrm.value;
237 return this.userservice.InsertUser(AddUserEntity) 276 return this.userservice.InsertUser(AddUserEntity)
@@ -253,22 +292,23 @@ export class AddUser implements OnInit, AfterViewInit { @@ -253,22 +292,23 @@ export class AddUser implements OnInit, AfterViewInit {
253 292
254 } 293 }
255 ResetForm() { 294 ResetForm() {
256 - this._buildForm(); 295 + var lcid= this.adduserFrm.controls['AccountNumberId'].value;
  296 + this._buildForm(lcid);
257 } 297 }
258 - _buildForm() { 298 + _buildForm(lcid) {
259 this.adduserFrm = this.fb.group({ 299 this.adduserFrm = this.fb.group({
260 id: [''], 300 id: [''],
261 - UserName: [""],  
262 - Password: [""],  
263 - ConfirmPassword: [""],  
264 - FirstName: [""],  
265 - LastName: [""],  
266 - EmailId: [""],  
267 - AccountNumberId: ["0"],  
268 - UserTypeId: ["0"],  
269 - ProductEditionId: ["0"]  
270 - 301 + UserName: ['', [Validators.required, Validators.minLength(8),this.noWhitespaceValidator]],
  302 + Password: ['', [Validators.required, Validators.minLength(8),this.noWhitespaceValidator]],
  303 + ConfirmPassword: ['', [Validators.required,this.noWhitespaceValidator]],
  304 + FirstName: ['', [Validators.required,this.noWhitespaceValidator]],
  305 + LastName: ['', [Validators.required,this.noWhitespaceValidator]],
  306 + EmailId: ['', [Validators.required,this.noWhitespaceValidator]],
  307 + AccountNumberId: ['', Validators.required],
  308 + UserTypeId: ['', Validators.required],
  309 + ProductEditionId: ['', Validators.required]
271 }); 310 });
  311 + this.bindUsers(lcid);
272 } 312 }
273 CheckDropDownOrUp(elm: any) { 313 CheckDropDownOrUp(elm: any) {
274 var dropDownTop = elm.children[0].offsetTop; 314 var dropDownTop = elm.children[0].offsetTop;
@@ -283,23 +323,31 @@ export class AddUser implements OnInit, AfterViewInit { @@ -283,23 +323,31 @@ export class AddUser implements OnInit, AfterViewInit {
283 } 323 }
284 @HostListener('window:scroll', ['$event']) 324 @HostListener('window:scroll', ['$event'])
285 onWindowScroll(event) { 325 onWindowScroll(event) {
286 - // console.debug("Scroll Event", document.body.scrollTop);  
287 - // see Andr๏ฟฝs Szepesh๏ฟฝzi's comment below  
288 - //console.debug("Scroll Event", window.pageYOffset );  
289 - this.CheckDropDownOrUp(this.accountNodiv.nativeElement); 326 + if(this.router.url === '/adduser')
  327 + {
  328 + this.CheckDropDownOrUp(this.accountNodiv.nativeElement);
  329 + }
290 } 330 }
291 331
292 @HostListener('window:resize', ['$event']) 332 @HostListener('window:resize', ['$event'])
293 onWindowResize(event) { 333 onWindowResize(event) {
294 - this.CheckDropDownOrUp(this.accountNodiv.nativeElement); 334 + if(this.router.url === '/adduser')
  335 + {
  336 + this.CheckDropDownOrUp(this.accountNodiv.nativeElement);
  337 + }
295 } 338 }
296 - bindUsers() {  
297 -  
298 - //console.log(data);  
299 - //alert(JSON.stringify(data));  
300 - //this.user = data[0];  
301 -  
302 - 339 + bindUsers(lcid) {
  340 + this.alerts = '';
  341 + if (this.commonService.UserTypeName == "Client Admin" || this.commonService.UserTypeName == "District Admin" )
  342 + {
  343 + this.adduserFrm.controls['AccountNumberId'].setValue(lcid)
  344 + }
  345 + else
  346 + {
  347 + this.accountDropDownText = 'Select';
  348 + this.adduserFrm.controls['AccountNumberId'].setValue(0)
  349 + }
  350 +
303 this.adduserFrm.controls['id'].setValue(0) 351 this.adduserFrm.controls['id'].setValue(0)
304 this.adduserFrm.controls['FirstName'].setValue('') 352 this.adduserFrm.controls['FirstName'].setValue('')
305 this.adduserFrm.controls['LastName'].setValue('') 353 this.adduserFrm.controls['LastName'].setValue('')
@@ -307,8 +355,17 @@ export class AddUser implements OnInit, AfterViewInit { @@ -307,8 +355,17 @@ export class AddUser implements OnInit, AfterViewInit {
307 this.adduserFrm.controls['UserName'].setValue('') 355 this.adduserFrm.controls['UserName'].setValue('')
308 this.adduserFrm.controls['Password'].setValue('') 356 this.adduserFrm.controls['Password'].setValue('')
309 this.adduserFrm.controls['ConfirmPassword'].setValue('') 357 this.adduserFrm.controls['ConfirmPassword'].setValue('')
310 - this.adduserFrm.controls['AccountNumberId'].setValue(0)  
311 - this.adduserFrm.controls['UserTypeId'].setValue(0) 358 +
  359 + if(this.router.url === '/adduser')
  360 + {
  361 + this.adduserFrm.controls['UserTypeId'].setValue(0)
  362 + }
  363 + else
  364 + {
  365 + // for genral admin
  366 + this.adduserFrm.controls['UserTypeId'].setValue(2)
  367 + }
  368 +
312 this.adduserFrm.controls['ProductEditionId'].setValue(0) 369 this.adduserFrm.controls['ProductEditionId'].setValue(0)
313 370
314 } 371 }
400-SOURCECODE/Admin/src/app/components/UserEntity/datamodel.ts
@@ -64,7 +64,7 @@ export class License { @@ -64,7 +64,7 @@ export class License {
64 ProductKey: string; 64 ProductKey: string;
65 SubscriptionStartDate: Date; 65 SubscriptionStartDate: Date;
66 SubscriptionEndDate: Date; 66 SubscriptionEndDate: Date;
67 - Renewdate: Date; 67 + RenewDate: Date;
68 EditionLogins: string; 68 EditionLogins: string;
69 Price: DoubleRange; 69 Price: DoubleRange;
70 NoOfImages: number; 70 NoOfImages: number;
400-SOURCECODE/Admin/src/app/components/UserEntity/unblockuser.component.ts
@@ -109,15 +109,23 @@ export class UnblockUser implements OnInit { @@ -109,15 +109,23 @@ export class UnblockUser implements OnInit {
109 109
110 GetBlockUserList(this) 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 this.licId =0 126 this.licId =0
120 } 127 }
  128 +
121 var UserFilterControl = this.UnBlockedUserFrm.value; 129 var UserFilterControl = this.UnBlockedUserFrm.value;
122 this.userservice.GetBlockUserList( 130 this.userservice.GetBlockUserList(
123 { 131 {
400-SOURCECODE/Admin/src/app/components/UserEntity/updateuserprofile.component.html
@@ -21,25 +21,26 @@ @@ -21,25 +21,26 @@
21 </div> 21 </div>
22 <div class="form-group"> 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 <div class="col-sm-7"> 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 </div> 28 </div>
29 </div> 29 </div>
30 <div class="form-group"> 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 <div class="col-sm-7"> 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 </div> 35 </div>
36 </div> 36 </div>
37 <div class="form-group"> 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 <div class="col-sm-7"> 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 </div> 44 </div>
44 </div> 45 </div>
45 <div class="form-group"> 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,17 +44,14 @@ export class UpdateUserProfile implements OnInit {
44 ngOnInit(): void { 44 ngOnInit(): void {
45 this.user = new User(); 45 this.user = new User();
46 this.alerts = ''; 46 this.alerts = '';
47 - //this.userservice.GetUserById(this.UserId);  
48 this.userFrm = this.fb.group({ 47 this.userFrm = this.fb.group({
49 id: [''], 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 this._loadingService.ShowLoading("global-loading"); 55 this._loadingService.ShowLoading("global-loading");
59 this.GetUserById(); 56 this.GetUserById();
60 57
@@ -62,21 +59,34 @@ export class UpdateUserProfile implements OnInit { @@ -62,21 +59,34 @@ export class UpdateUserProfile implements OnInit {
62 redirect() { 59 redirect() {
63 this.router.navigate(['/']); 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==undefined)//undefined for integer value
  70 + {
  71 + isValid=true;
  72 + }
  73 + else if(controlLen!=0)
  74 + {
  75 + const isWhitespace = (control.value || '').trim().length === 0;
  76 + isValid = !isWhitespace;
  77 + if(!isValid)
  78 + {
  79 + control.setValue('');
  80 +
  81 + }
  82 + }
  83 + }
  84 + // can use also on page of input control
  85 + //
  86 + return isValid ? null: { 'whitespace': true };
  87 +
  88 +}
  89 +
80 GetUserById() { 90 GetUserById() {
81 91
82 this.userservice.GetUserById() 92 this.userservice.GetUserById()
@@ -84,24 +94,35 @@ export class UpdateUserProfile implements OnInit { @@ -84,24 +94,35 @@ export class UpdateUserProfile implements OnInit {
84 this._loadingService.HideLoading("global-loading"); 94 this._loadingService.HideLoading("global-loading");
85 } 95 }
86 UpdateUserProfile() { 96 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) 97 + this.alerts = '';
  98 + if (this.userFrm.value.firstName == null ||((this.userFrm.value.firstName).trim() == ''))
  99 + {
  100 + this.alerts += '<span>First name is required.</span></br>';
  101 + }
  102 + if (this.userFrm.value.lastName == null ||((this.userFrm.value.lastName).trim() == ''))
  103 + {
  104 + this.alerts += '<span>Last name is required.</span></br>';
  105 + }
  106 + if (this.userFrm.value.emailId == null ||((this.userFrm.value.emailId).trim() == '')) {
  107 + this.alerts += '<span>Email Id is required.</span>';
  108 + }
  109 + else if((!this.userFrm.controls.emailId.valid))
  110 + {
  111 + this.alerts += '<span>Enter Valid Email Id.</span>';
  112 + }
  113 +
  114 +
  115 + if (this.userFrm.valid && this.alerts == '') {
  116 + var obj = this.userFrm.value;
  117 +
  118 + return this.userservice.UpdateUserProfileById(obj)
94 .subscribe( 119 .subscribe(
95 n => (this.AfterInsertData(n)), 120 n => (this.AfterInsertData(n)),
96 error => this.error = <any>error); 121 error => this.error = <any>error);
97 } 122 }
98 } 123 }
99 AfterInsertData(data) { 124 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; 125 + if (data.Status == "False") {
105 return false; 126 return false;
106 } else { 127 } else {
107 this.status = true; 128 this.status = true;
@@ -112,34 +133,9 @@ export class UpdateUserProfile implements OnInit { @@ -112,34 +133,9 @@ export class UpdateUserProfile implements OnInit {
112 localStorage.setItem("loggedInUserDetails", JSON.stringify(loggedInUser)); 133 localStorage.setItem("loggedInUserDetails", JSON.stringify(loggedInUser));
113 this.global.DisplayName = loggedInUser.FirstName + " " + loggedInUser.LastName; 134 this.global.DisplayName = loggedInUser.FirstName + " " + loggedInUser.LastName;
114 this._confirmService.activate("User Profile Updated Successfully.", "alertMsg"); 135 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); 136 +
137 } 137 }
138 - //if (this.closeflag) {  
139 - // this.close.emit(null);  
140 - //}  
141 - //else {  
142 - //} 138 +
143 } 139 }
144 bindUsers(data) { 140 bindUsers(data) {
145 141
@@ -152,23 +148,8 @@ export class UpdateUserProfile implements OnInit { @@ -152,23 +148,8 @@ export class UpdateUserProfile implements OnInit {
152 this.userFrm.controls['firstName'].setValue(this.user.FirstName) 148 this.userFrm.controls['firstName'].setValue(this.user.FirstName)
153 this.userFrm.controls['lastName'].setValue(this.user.LastName) 149 this.userFrm.controls['lastName'].setValue(this.user.LastName)
154 this.userFrm.controls['emailId'].setValue(this.user.EmailId) 150 this.userFrm.controls['emailId'].setValue(this.user.EmailId)
155 - // this.GetClientListOptions(false);  
156 - // this.GetCrossRefClientListOptions(false);  
157 } 151 }
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 - //} 152 +
172 validationMessages = { 153 validationMessages = {
173 'firstName': { 154 'firstName': {
174 'required': 'First name is required.' 155 'required': 'First name is required.'
400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.html
@@ -168,7 +168,7 @@ @@ -168,7 +168,7 @@
168 </div> 168 </div>
169 </form> 169 </form>
170 170
171 - <div style="position: absolute; z-index: 100; width: 80%" [style.top]="topPos" [style.display]="(Mode=='Add' || Mode=='Edit') ? 'block' : 'none'" 171 + <div style="position: absolute; z-index: 100; width: 100%" [style.top]="topPos" [style.display]="(Mode=='Add' || Mode=='Edit') ? 'block' : 'none'"
172 class="well"> 172 class="well">
173 <div class="row"> 173 <div class="row">
174 <div class="col-sm-12"> 174 <div class="col-sm-12">
400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts
@@ -88,12 +88,12 @@ export class UsersList implements OnInit, AfterViewChecked { @@ -88,12 +88,12 @@ export class UsersList implements OnInit, AfterViewChecked {
88 }); 88 });
89 this.adduserFrm = this.fb.group({ 89 this.adduserFrm = this.fb.group({
90 id: [''], 90 id: [''],
91 - UserName: ['', [Validators.required, Validators.minLength(8)]],  
92 - Password: ['', [Validators.required, Validators.minLength(8)]],  
93 - ConfirmPassword: ['', Validators.required],  
94 - FirstName: ['', Validators.required],  
95 - LastName: ['', Validators.required],  
96 - EmailId: ['', Validators.required], 91 + UserName: ['', [Validators.required, Validators.minLength(8),this.noWhitespaceValidator]],
  92 + Password: ['', [Validators.required, Validators.minLength(8),this.noWhitespaceValidator]],
  93 + ConfirmPassword: ['', [Validators.required,this.noWhitespaceValidator]],
  94 + FirstName: ['', [Validators.required,this.noWhitespaceValidator]],
  95 + LastName: ['', [Validators.required,this.noWhitespaceValidator]],
  96 + EmailId: ['', [Validators.required,this.noWhitespaceValidator]],
97 AccountNumber: [''], 97 AccountNumber: [''],
98 UserTypeTitle: [''], 98 UserTypeTitle: [''],
99 AccountTypeTitle: [''], 99 AccountTypeTitle: [''],
@@ -114,9 +114,14 @@ export class UsersList implements OnInit, AfterViewChecked { @@ -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 this._loadingService.ShowLoading("global-loading"); 126 this._loadingService.ShowLoading("global-loading");
122 this.GetUserType(); 127 this.GetUserType();
@@ -167,6 +172,33 @@ export class UsersList implements OnInit, AfterViewChecked { @@ -167,6 +172,33 @@ export class UsersList implements OnInit, AfterViewChecked {
167 172
168 //this.GetUserList(); 173 //this.GetUserList();
169 } 174 }
  175 + public noWhitespaceValidator(control: FormControl) {
  176 + // new validation for intial whaite space
  177 + //****Birendra *****/
  178 + var isValid=false;
  179 + if(control.value!=null)
  180 + {
  181 + var controlLen=control.value.length;
  182 + if(controlLen==undefined)//undefined for integer value
  183 + {
  184 + isValid=true;
  185 + }
  186 + else if(controlLen!=0)
  187 + {
  188 + const isWhitespace = (control.value || '').trim().length === 0;
  189 + isValid = !isWhitespace;
  190 + if(!isValid)
  191 + {
  192 + control.setValue('');
  193 +
  194 + }
  195 + }
  196 + }
  197 + // can use also on page of input control
  198 + //
  199 + return isValid ? null: { 'whitespace': true };
  200 +
  201 + }
170 handleChange(evt) { 202 handleChange(evt) {
171 var target = evt.target; 203 var target = evt.target;
172 if (target.value == 'true') { 204 if (target.value == 'true') {
400-SOURCECODE/Admin/src/assets/data/Menu.json
@@ -85,7 +85,7 @@ @@ -85,7 +85,7 @@
85 "SubMenuName": "Add User", 85 "SubMenuName": "Add User",
86 "SubMenuUrl": "adduser", 86 "SubMenuUrl": "adduser",
87 "SubMenuStatus": "True" 87 "SubMenuStatus": "True"
88 - }, 88 + },
89 { 89 {
90 "SubMenuId": "209", 90 "SubMenuId": "209",
91 "SubMenuName": "Unblock User", 91 "SubMenuName": "Unblock User",
@@ -292,7 +292,7 @@ @@ -292,7 +292,7 @@
292 "SubMenuName": "Add User", 292 "SubMenuName": "Add User",
293 "SubMenuUrl": "adduser", 293 "SubMenuUrl": "adduser",
294 "SubMenuStatus": "True" 294 "SubMenuStatus": "True"
295 - }, 295 + },
296 { 296 {
297 "SubMenuId": "209", 297 "SubMenuId": "209",
298 "SubMenuName": "Unblock User", 298 "SubMenuName": "Unblock User",
@@ -1275,19 +1275,19 @@ @@ -1275,19 +1275,19 @@
1275 { 1275 {
1276 "HeaderMenuId": "101", 1276 "HeaderMenuId": "101",
1277 "HeaderMenuName": "Licenses", 1277 "HeaderMenuName": "Licenses",
1278 - "HeaderMenuStatus": "True", 1278 + "HeaderMenuStatus": "False",
1279 "SubMenu": [ 1279 "SubMenu": [
1280 { 1280 {
1281 "SubMenuId": "203", 1281 "SubMenuId": "203",
1282 "SubMenuName": "Search License", 1282 "SubMenuName": "Search License",
1283 "SubMenuUrl": "searchlicense", 1283 "SubMenuUrl": "searchlicense",
1284 - "SubMenuStatus": "True" 1284 + "SubMenuStatus": "False"
1285 }, 1285 },
1286 { 1286 {
1287 "SubMenuId": "204", 1287 "SubMenuId": "204",
1288 "SubMenuName": "Add New License", 1288 "SubMenuName": "Add New License",
1289 "SubMenuUrl": "addlicense", 1289 "SubMenuUrl": "addlicense",
1290 - "SubMenuStatus": "True" 1290 + "SubMenuStatus": "False"
1291 } 1291 }
1292 1292
1293 ] 1293 ]
@@ -1295,19 +1295,19 @@ @@ -1295,19 +1295,19 @@
1295 { 1295 {
1296 "HeaderMenuId": "102", 1296 "HeaderMenuId": "102",
1297 "HeaderMenuName": "Product Features", 1297 "HeaderMenuName": "Product Features",
1298 - "HeaderMenuStatus": "True", 1298 + "HeaderMenuStatus": "False",
1299 "SubMenu": [ 1299 "SubMenu": [
1300 { 1300 {
1301 "SubMenuId": "205", 1301 "SubMenuId": "205",
1302 "SubMenuName": "Manage Discount Code", 1302 "SubMenuName": "Manage Discount Code",
1303 "SubMenuUrl": "managediscountcode", 1303 "SubMenuUrl": "managediscountcode",
1304 - "SubMenuStatus": "True" 1304 + "SubMenuStatus": "False"
1305 }, 1305 },
1306 { 1306 {
1307 "SubMenuId": "206", 1307 "SubMenuId": "206",
1308 "SubMenuName": "Subscription Price", 1308 "SubMenuName": "Subscription Price",
1309 "SubMenuUrl": "subscriptionprice", 1309 "SubMenuUrl": "subscriptionprice",
1310 - "SubMenuStatus": "True" 1310 + "SubMenuStatus": "False"
1311 } 1311 }
1312 1312
1313 ] 1313 ]
@@ -1315,31 +1315,31 @@ @@ -1315,31 +1315,31 @@
1315 { 1315 {
1316 "HeaderMenuId": "103", 1316 "HeaderMenuId": "103",
1317 "HeaderMenuName": "Users", 1317 "HeaderMenuName": "Users",
1318 - "HeaderMenuStatus": "True", 1318 + "HeaderMenuStatus": "False",
1319 "SubMenu": [ 1319 "SubMenu": [
1320 { 1320 {
1321 "SubMenuId": "207", 1321 "SubMenuId": "207",
1322 "SubMenuName": "List User", 1322 "SubMenuName": "List User",
1323 "SubMenuUrl": "users", 1323 "SubMenuUrl": "users",
1324 - "SubMenuStatus": "True" 1324 + "SubMenuStatus": "False"
1325 }, 1325 },
1326 { 1326 {
1327 "SubMenuId": "208", 1327 "SubMenuId": "208",
1328 "SubMenuName": "Add User", 1328 "SubMenuName": "Add User",
1329 "SubMenuUrl": "adduser", 1329 "SubMenuUrl": "adduser",
1330 - "SubMenuStatus": "True" 1330 + "SubMenuStatus": "False"
1331 }, 1331 },
1332 { 1332 {
1333 "SubMenuId": "209", 1333 "SubMenuId": "209",
1334 "SubMenuName": "Unblock User", 1334 "SubMenuName": "Unblock User",
1335 "SubMenuUrl": "unblockuser", 1335 "SubMenuUrl": "unblockuser",
1336 - "SubMenuStatus": "True" 1336 + "SubMenuStatus": "False"
1337 }, 1337 },
1338 { 1338 {
1339 "SubMenuId": "210", 1339 "SubMenuId": "210",
1340 "SubMenuName": "User Group", 1340 "SubMenuName": "User Group",
1341 "SubMenuUrl": "usergroup", 1341 "SubMenuUrl": "usergroup",
1342 - "SubMenuStatus": "True" 1342 + "SubMenuStatus": "False"
1343 } 1343 }
1344 1344
1345 ] 1345 ]
@@ -1347,49 +1347,49 @@ @@ -1347,49 +1347,49 @@
1347 { 1347 {
1348 "HeaderMenuId": "104", 1348 "HeaderMenuId": "104",
1349 "HeaderMenuName": "Reports", 1349 "HeaderMenuName": "Reports",
1350 - "HeaderMenuStatus": "True", 1350 + "HeaderMenuStatus": "False",
1351 "SubMenu": [ 1351 "SubMenu": [
1352 { 1352 {
1353 "SubMenuId": "211", 1353 "SubMenuId": "211",
1354 "SubMenuName": "Usage Report", 1354 "SubMenuName": "Usage Report",
1355 "SubMenuUrl": "usagereport", 1355 "SubMenuUrl": "usagereport",
1356 - "SubMenuStatus": "True" 1356 + "SubMenuStatus": "False"
1357 }, 1357 },
1358 { 1358 {
1359 "SubMenuId": "212", 1359 "SubMenuId": "212",
1360 "SubMenuName": "Customer Summary Report", 1360 "SubMenuName": "Customer Summary Report",
1361 "SubMenuUrl": "customersummaryreport", 1361 "SubMenuUrl": "customersummaryreport",
1362 - "SubMenuStatus": "True" 1362 + "SubMenuStatus": "False"
1363 }, 1363 },
1364 { 1364 {
1365 "SubMenuId": "213", 1365 "SubMenuId": "213",
1366 "SubMenuName": "Expiring Subscription Report", 1366 "SubMenuName": "Expiring Subscription Report",
1367 "SubMenuUrl": "expiringsubscriptionreport", 1367 "SubMenuUrl": "expiringsubscriptionreport",
1368 - "SubMenuStatus": "True" 1368 + "SubMenuStatus": "False"
1369 }, 1369 },
1370 { 1370 {
1371 "SubMenuId": "214", 1371 "SubMenuId": "214",
1372 "SubMenuName": "New Subscription Report", 1372 "SubMenuName": "New Subscription Report",
1373 "SubMenuUrl": "subscriptionreport", 1373 "SubMenuUrl": "subscriptionreport",
1374 - "SubMenuStatus": "True" 1374 + "SubMenuStatus": "False"
1375 }, 1375 },
1376 { 1376 {
1377 "SubMenuId": "215", 1377 "SubMenuId": "215",
1378 "SubMenuName": "Subscription Cancellation Report", 1378 "SubMenuName": "Subscription Cancellation Report",
1379 "SubMenuUrl": "subscriptioncancellationreport", 1379 "SubMenuUrl": "subscriptioncancellationreport",
1380 - "SubMenuStatus": "True" 1380 + "SubMenuStatus": "False"
1381 }, 1381 },
1382 { 1382 {
1383 "SubMenuId": "216", 1383 "SubMenuId": "216",
1384 "SubMenuName": "Net AD Subscription Report", 1384 "SubMenuName": "Net AD Subscription Report",
1385 "SubMenuUrl": "netadsubscriptionreport", 1385 "SubMenuUrl": "netadsubscriptionreport",
1386 - "SubMenuStatus": "True" 1386 + "SubMenuStatus": "False"
1387 }, 1387 },
1388 { 1388 {
1389 "SubMenuId": "217", 1389 "SubMenuId": "217",
1390 "SubMenuName": "Site License Usage Report", 1390 "SubMenuName": "Site License Usage Report",
1391 "SubMenuUrl": "sitelicenseusagereport", 1391 "SubMenuUrl": "sitelicenseusagereport",
1392 - "SubMenuStatus": "True" 1392 + "SubMenuStatus": "False"
1393 }, 1393 },
1394 { 1394 {
1395 "SubMenuId": "218", 1395 "SubMenuId": "218",
@@ -1409,13 +1409,13 @@ @@ -1409,13 +1409,13 @@
1409 { 1409 {
1410 "HeaderMenuId": "105", 1410 "HeaderMenuId": "105",
1411 "HeaderMenuName": "Site Account", 1411 "HeaderMenuName": "Site Account",
1412 - "HeaderMenuStatus": "True", 1412 + "HeaderMenuStatus": "False",
1413 "SubMenu": [ 1413 "SubMenu": [
1414 { 1414 {
1415 "SubMenuId": "220", 1415 "SubMenuId": "220",
1416 "SubMenuName": "Add Building Level Account", 1416 "SubMenuName": "Add Building Level Account",
1417 "SubMenuUrl": "sitelicenseaccount", 1417 "SubMenuUrl": "sitelicenseaccount",
1418 - "SubMenuStatus": "True" 1418 + "SubMenuStatus": "False"
1419 } 1419 }
1420 1420
1421 ] 1421 ]
@@ -1423,19 +1423,19 @@ @@ -1423,19 +1423,19 @@
1423 { 1423 {
1424 "HeaderMenuId": "106", 1424 "HeaderMenuId": "106",
1425 "HeaderMenuName": "Settings", 1425 "HeaderMenuName": "Settings",
1426 - "HeaderMenuStatus": "True", 1426 + "HeaderMenuStatus": "False",
1427 "SubMenu": [ 1427 "SubMenu": [
1428 { 1428 {
1429 "SubMenuId": "221", 1429 "SubMenuId": "221",
1430 "SubMenuName": "View-Update Profile", 1430 "SubMenuName": "View-Update Profile",
1431 "SubMenuUrl": "editlicensebasicsettings", 1431 "SubMenuUrl": "editlicensebasicsettings",
1432 - "SubMenuStatus": "True" 1432 + "SubMenuStatus": "False"
1433 }, 1433 },
1434 { 1434 {
1435 "SubMenuId": "222", 1435 "SubMenuId": "222",
1436 "SubMenuName": "Manage Modesty Settings", 1436 "SubMenuName": "Manage Modesty Settings",
1437 "SubMenuUrl": "licensemodestysettings", 1437 "SubMenuUrl": "licensemodestysettings",
1438 - "SubMenuStatus": "True" 1438 + "SubMenuStatus": "False"
1439 }, 1439 },
1440 { 1440 {
1441 "SubMenuId": "223", 1441 "SubMenuId": "223",