Commit 83095eaa690f5082395218a58dedadbdf5dba827

Authored by Birendra Kumar
1 parent 55309a92

partially committed admin bug fixes

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 = (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/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/app.routing.module.ts
@@ -33,6 +33,7 @@ const appRoutes: Routes = [ @@ -33,6 +33,7 @@ const appRoutes: Routes = [
33 { path: 'managediscountcode', component: ManageDiscountCode }, 33 { path: 'managediscountcode', component: ManageDiscountCode },
34 { path: 'subscriptionprice', component: SubscriptionPrice }, 34 { path: 'subscriptionprice', component: SubscriptionPrice },
35 { path: 'adduser', component: AddUser }, 35 { path: 'adduser', component: AddUser },
  36 + { path: 'addgeneral', component: AddUser },
36 { path: 'unblockuser', component: UnblockUser }, 37 { path: 'unblockuser', component: UnblockUser },
37 { path: 'searchlicense', component: SearchLicense }, 38 { path: 'searchlicense', component: SearchLicense },
38 { path: 'addlicense', component: AddLicense }, 39 { path: 'addlicense', component: AddLicense },
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,39 @@ export class AddLicense implements OnInit { @@ -63,39 +63,39 @@ 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: ['', Validators.required],
99 totalRenewals: [0], 99 totalRenewals: [0],
100 isActive: ['false'] 100 isActive: ['false']
101 }); 101 });
@@ -133,7 +133,76 @@ export class AddLicense implements OnInit { @@ -133,7 +133,76 @@ export class AddLicense implements OnInit {
133 }); 133 });
134 }, error => this.error = <any>error); 134 }, error => this.error = <any>error);
135 } 135 }
  136 + public noWhitespaceValidator(control: FormControl) {
  137 + // new validation for intial whaite space
  138 + //****Birendra *****/
  139 + var isValid=false;
  140 + if(control.value!=null)
  141 + {
  142 + var controlLen=control.value.length;
  143 + if(controlLen==undefined)//undefined for integer value
  144 + {
  145 + isValid=true;
  146 + }
  147 + else if(controlLen!=0)
  148 + {
  149 + const isWhitespace = (control.value || '').trim().length === 0;
  150 + isValid = !isWhitespace;
  151 + if(!isValid)
  152 + {
  153 + control.setValue('');
  154 +
  155 + }
  156 + }
  157 + }
  158 + // can use also on page of input control
  159 + //
  160 + return isValid ? null: { 'whitespace': true };
  161 +
  162 + }
  163 +
  164 + onKeyUp(event: any) {
  165 + var mobno = event.target.value;
  166 + var newnum=mobno;
  167 + if(mobno!="" && event.key!="Backspace")
  168 + {
  169 + var tempArr = mobno.split('-');
  170 +
  171 + if(tempArr.length==1)
  172 + {
  173 + var countdigit=tempArr[0].length;
  174 + newnum=tempArr[0];
  175 + if(countdigit==3)
  176 + {
  177 + newnum=tempArr[0]+"-";
  178 + }
  179 + else if(countdigit>3)
  180 + {
  181 + newnum=tempArr[0].substr(0,3)+"-"+tempArr[0].substr(3,1);
  182 + }
  183 +
  184 + }
  185 + else if(tempArr.length==2)
  186 + {
  187 + newnum=tempArr[0]+"-"+tempArr[1];
  188 + var countdigit=tempArr[1].length;
  189 + if(countdigit==3)
  190 + {
  191 + newnum=tempArr[0]+"-"+tempArr[1]+"-";
  192 + }
  193 + else if(countdigit>3)
  194 + {
  195 + newnum= tempArr[0]+"-"+tempArr[1].substr(0,3)+"-"+tempArr[1].substr(3,1);
  196 + }
  197 + }
  198 + else
  199 + {
  200 + newnum=tempArr[0]+"-"+tempArr[1]+"-"+tempArr[2];
  201 + }
136 202
  203 + }
  204 + this.insertUpdateLicenseFrm.controls['phone'].setValue(newnum);
  205 +};
137 206
138 openModal(template: TemplateRef<any>) { 207 openModal(template: TemplateRef<any>) {
139 this.modalRef = this.modalService.show(template); 208 this.modalRef = this.modalService.show(template);
@@ -157,6 +226,34 @@ export class AddLicense implements OnInit { @@ -157,6 +226,34 @@ export class AddLicense implements OnInit {
157 this.OnLoginBlur(); 226 this.OnLoginBlur();
158 } 227 }
159 228
  229 + // clear alert on check/uncheck renew checkbox
  230 + reNewChange(isChecked: boolean)
  231 + {
  232 + this.alerts = '';
  233 + this.NumberOfRows=0;
  234 + if (this.insertUpdateLicenseFrm.controls['licenseTypeId'].value == 2) {
  235 + this.insertUpdateLicenseFrm.controls['editionLoginArr'].value.forEach(element => {
  236 + if(this.NumberOfRows >1)
  237 + {
  238 + this.alerts = "<span>Please select one edition only.</span>";
  239 + }
  240 + else{
  241 + if (element.Checked == 1 && element.Login > 0) {
  242 + this.NumberOfRows+=1
  243 + }
  244 + else if (element.Checked == 1)
  245 + {
  246 + this.NumberOfRows+=1
  247 + }
  248 +
  249 + }
  250 + });
  251 + if(this.totalLogins>1)
  252 + {
  253 + this.alerts += "<br><span>For single license total login can not be more than one.</span>";
  254 + }
  255 + }
  256 + }
160 DateChange(dateValue: any) { 257 DateChange(dateValue: any) {
161 this.alerts = ''; 258 this.alerts = '';
162 this.NumberOfRows=0; 259 this.NumberOfRows=0;
@@ -289,7 +386,7 @@ export class AddLicense implements OnInit { @@ -289,7 +386,7 @@ export class AddLicense implements OnInit {
289 if (this.license.SiteUrlTo == null) { 386 if (this.license.SiteUrlTo == null) {
290 this.license.SiteUrlTo = ''; 387 this.license.SiteUrlTo = '';
291 } 388 }
292 - this.LicenseTypeChanged(this.license.LicenseTypeId); 389 + this.LicenseTypeChanged(this.license.LicenseTypeId,this.license.SubscriptionStartDate);
293 this.insertUpdateLicenseFrm.controls['licenseId'].setValue(this.license.LicenseId); 390 this.insertUpdateLicenseFrm.controls['licenseId'].setValue(this.license.LicenseId);
294 this.insertUpdateLicenseFrm.controls['licenseTypeId'].setValue(this.license.LicenseTypeId); 391 this.insertUpdateLicenseFrm.controls['licenseTypeId'].setValue(this.license.LicenseTypeId);
295 this.insertUpdateLicenseFrm.controls['accountNumber'].setValue(this.license.AccountNumber); 392 this.insertUpdateLicenseFrm.controls['accountNumber'].setValue(this.license.AccountNumber);
@@ -300,7 +397,7 @@ export class AddLicense implements OnInit { @@ -300,7 +397,7 @@ export class AddLicense implements OnInit {
300 this.insertUpdateLicenseFrm.controls['institutionName'].setValue(this.license.InstitutionName); 397 this.insertUpdateLicenseFrm.controls['institutionName'].setValue(this.license.InstitutionName);
301 this.insertUpdateLicenseFrm.controls['address1'].setValue(this.license.Address1); 398 this.insertUpdateLicenseFrm.controls['address1'].setValue(this.license.Address1);
302 this.insertUpdateLicenseFrm.controls['address2'].setValue(this.license.Address2); 399 this.insertUpdateLicenseFrm.controls['address2'].setValue(this.license.Address2);
303 - this.insertUpdateLicenseFrm.controls['city'].setValue(this.license.City); 400 + this.insertUpdateLicenseFrm.controls['city'].setValue(this.license.City);
304 this.insertUpdateLicenseFrm.controls['stateId'].setValue(this.license.StateId); 401 this.insertUpdateLicenseFrm.controls['stateId'].setValue(this.license.StateId);
305 this.insertUpdateLicenseFrm.controls['countryId'].setValue(this.license.CountryId); 402 this.insertUpdateLicenseFrm.controls['countryId'].setValue(this.license.CountryId);
306 this.insertUpdateLicenseFrm.controls['zip'].setValue(this.license.Zip); 403 this.insertUpdateLicenseFrm.controls['zip'].setValue(this.license.Zip);
@@ -310,7 +407,7 @@ export class AddLicense implements OnInit { @@ -310,7 +407,7 @@ export class AddLicense implements OnInit {
310 this.insertUpdateLicenseFrm.controls['subscriptionPrice'].setValue(this.license.Price); 407 this.insertUpdateLicenseFrm.controls['subscriptionPrice'].setValue(this.license.Price);
311 this.insertUpdateLicenseFrm.controls['subscriptionStartDate'].setValue(this.datePipe.transform(this.license.SubscriptionStartDate, 'MM/dd/yyyy')); 408 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')); 409 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')); 410 + this.insertUpdateLicenseFrm.controls['renewDate'].setValue(this.datePipe.transform(this.license.RenewDate, 'MM/dd/yyyy'));
314 this.insertUpdateLicenseFrm.controls['noOfImages'].setValue(this.license.NoOfImages); 411 this.insertUpdateLicenseFrm.controls['noOfImages'].setValue(this.license.NoOfImages);
315 this.insertUpdateLicenseFrm.controls['masterSiteUrl'].setValue(this.license.MasterSiteUrl); 412 this.insertUpdateLicenseFrm.controls['masterSiteUrl'].setValue(this.license.MasterSiteUrl);
316 this.insertUpdateLicenseFrm.controls['siteUrlFrom'].setValue(this.license.SiteUrlFrom); 413 this.insertUpdateLicenseFrm.controls['siteUrlFrom'].setValue(this.license.SiteUrlFrom);
@@ -331,10 +428,10 @@ export class AddLicense implements OnInit { @@ -331,10 +428,10 @@ export class AddLicense implements OnInit {
331 428
332 this.insertUpdateLicenseFrm.controls['phone'].clearValidators(); 429 this.insertUpdateLicenseFrm.controls['phone'].clearValidators();
333 if (this.lstCountry.find(C => C.Id == this.license.CountryId).CountryName != "United States") { 430 if (this.lstCountry.find(C => C.Id == this.license.CountryId).CountryName != "United States") {
334 - this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required]); 431 + this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required,this.noWhitespaceValidator]);
335 } 432 }
336 else { 433 else {
337 - this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]); 434 + this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$'),this.noWhitespaceValidator]);
338 } 435 }
339 this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity(); 436 this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity();
340 this.insertUpdateLicenseFrm.controls['phone'].setValue(this.license.Phone); 437 this.insertUpdateLicenseFrm.controls['phone'].setValue(this.license.Phone);
@@ -471,7 +568,15 @@ export class AddLicense implements OnInit { @@ -471,7 +568,15 @@ export class AddLicense implements OnInit {
471 } 568 }
472 } 569 }
473 570
474 - LicenseTypeChanged(LicenseTypeId: number) { 571 + LicenseTypeChanged(LicenseTypeId: number,startDate: Date) {
  572 +
  573 + var currentDate = new Date();
  574 +
  575 + if(startDate==undefined)
  576 + {
  577 + this.insertUpdateLicenseFrm.controls['subscriptionStartDate'].setValue(currentDate);
  578 +
  579 + }
475 this.totalLogins = 0; 580 this.totalLogins = 0;
476 this.editionLoginsText = ''; 581 this.editionLoginsText = '';
477 this.license.TotalLogins = this.totalLogins; 582 this.license.TotalLogins = this.totalLogins;
@@ -483,6 +588,7 @@ export class AddLicense implements OnInit { @@ -483,6 +588,7 @@ export class AddLicense implements OnInit {
483 this.insertUpdateLicenseFrm.controls['subscriptionPrice'].setValue(''); 588 this.insertUpdateLicenseFrm.controls['subscriptionPrice'].setValue('');
484 this.insertUpdateLicenseFrm.controls['masterSiteUrl'].setValue(''); 589 this.insertUpdateLicenseFrm.controls['masterSiteUrl'].setValue('');
485 this.insertUpdateLicenseFrm.controls['accountNumber'].setValue(''); 590 this.insertUpdateLicenseFrm.controls['accountNumber'].setValue('');
  591 +
486 this.lstEditionLogins = new Array(); 592 this.lstEditionLogins = new Array();
487 this.lstEdition.forEach(element => { 593 this.lstEdition.forEach(element => {
488 this.lstEditionLogins.push({ Id: element.Id, Title: element.Title, Login: 0 }); 594 this.lstEditionLogins.push({ Id: element.Id, Title: element.Title, Login: 0 });
@@ -574,10 +680,10 @@ export class AddLicense implements OnInit { @@ -574,10 +680,10 @@ export class AddLicense implements OnInit {
574 this.alerts += '<span>Account number already exists. Enter a different account number.</span>'; 680 this.alerts += '<span>Account number already exists. Enter a different account number.</span>';
575 } 681 }
576 if (this.alerts == '') { 682 if (this.alerts == '') {
577 - return this.licenseService.InsertLicense(obj)  
578 - .subscribe(  
579 - n => (this.AfterInsertData(n, template)),  
580 - error => this.error = <any>error); 683 + // return this.licenseService.InsertLicense(obj)
  684 + // .subscribe(
  685 + // n => (this.AfterInsertData(n, template)),
  686 + // error => this.error = <any>error);
581 } 687 }
582 }, 688 },
583 error => this.error = <any>error); 689 error => this.error = <any>error);
@@ -589,10 +695,10 @@ export class AddLicense implements OnInit { @@ -589,10 +695,10 @@ export class AddLicense implements OnInit {
589 if (this.alerts == '') { 695 if (this.alerts == '') {
590 console.log(this.insertUpdateLicenseFrm.controls['subscriptionStartDate'].value + ', ' + this.insertUpdateLicenseFrm.controls['subscriptionEndDate'].value + ', ' + this.insertUpdateLicenseFrm.controls['renewDate'].value); 696 console.log(this.insertUpdateLicenseFrm.controls['subscriptionStartDate'].value + ', ' + this.insertUpdateLicenseFrm.controls['subscriptionEndDate'].value + ', ' + this.insertUpdateLicenseFrm.controls['renewDate'].value);
591 console.log(obj.subscriptionStartDate + ', ' + obj.subscriptionEndDate + ', ' + obj.renewDate); 697 console.log(obj.subscriptionStartDate + ', ' + obj.subscriptionEndDate + ', ' + obj.renewDate);
592 - return this.licenseService.UpdateLicense(obj)  
593 - .subscribe(  
594 - n => (this.AfterUpdateData(n, template)),  
595 - error => this.error = <any>error); 698 + // return this.licenseService.UpdateLicense(obj)
  699 + // .subscribe(
  700 + // n => (this.AfterUpdateData(n, template)),
  701 + // error => this.error = <any>error);
596 } 702 }
597 } 703 }
598 } 704 }
@@ -612,16 +718,16 @@ export class AddLicense implements OnInit { @@ -612,16 +718,16 @@ export class AddLicense implements OnInit {
612 if (this.lstCountry.find(C => C.Id == this.license.CountryId).CountryName != "United States") { 718 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; 719 this.license.StateId = this.lstState.find(C => C.StateName == "Other").Id;
614 this.insertUpdateLicenseFrm.controls['stateId'].setValue(this.license.StateId); 720 this.insertUpdateLicenseFrm.controls['stateId'].setValue(this.license.StateId);
615 - this.insertUpdateLicenseFrm.controls['phone'].clearValidators();  
616 - this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required]); 721 + // this.insertUpdateLicenseFrm.controls['phone'].clearValidators();
  722 + // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required,this.noWhitespaceValidator]);
617 } 723 }
618 else { 724 else {
619 this.license.StateId = 0; 725 this.license.StateId = 0;
620 this.insertUpdateLicenseFrm.controls['stateId'].setValue(this.license.StateId); 726 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})$')]); 727 + // this.insertUpdateLicenseFrm.controls['phone'].clearValidators();
  728 + // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$'),this.noWhitespaceValidator]);
623 } 729 }
624 - this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity(); 730 + //this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity();
625 } 731 }
626 732
627 OnStateChange(element: any) { 733 OnStateChange(element: any) {
@@ -629,16 +735,16 @@ export class AddLicense implements OnInit { @@ -629,16 +735,16 @@ export class AddLicense implements OnInit {
629 if (this.lstState.find(C => C.Id == this.license.StateId).StateName != "Other") { 735 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; 736 this.license.CountryId = this.lstCountry.find(C => C.CountryName == "United States").Id;
631 this.insertUpdateLicenseFrm.controls['countryId'].setValue(this.license.CountryId); 737 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})$')]); 738 + // this.insertUpdateLicenseFrm.controls['phone'].clearValidators();
  739 + // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$'),this.noWhitespaceValidator]);
634 } 740 }
635 else { 741 else {
636 this.license.CountryId = 0; 742 this.license.CountryId = 0;
637 this.insertUpdateLicenseFrm.controls['countryId'].setValue(this.license.CountryId); 743 this.insertUpdateLicenseFrm.controls['countryId'].setValue(this.license.CountryId);
638 - this.insertUpdateLicenseFrm.controls['phone'].clearValidators();  
639 - this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required]); 744 + // this.insertUpdateLicenseFrm.controls['phone'].clearValidators();
  745 + // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required,this.noWhitespaceValidator]);
640 } 746 }
641 - this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity(); 747 + // this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity();
642 } 748 }
643 749
644 SubscriptionPriceBlur() { 750 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/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/updateuserprofile.component.ts
@@ -66,7 +66,11 @@ export class UpdateUserProfile implements OnInit { @@ -66,7 +66,11 @@ export class UpdateUserProfile implements OnInit {
66 if(control.value!=null) 66 if(control.value!=null)
67 { 67 {
68 var controlLen=control.value.length; 68 var controlLen=control.value.length;
69 - if(controlLen!=0) 69 + if(controlLen==undefined)//undefined for integer value
  70 + {
  71 + isValid=true;
  72 + }
  73 + else if(controlLen!=0)
70 { 74 {
71 const isWhitespace = (control.value || '').trim().length === 0; 75 const isWhitespace = (control.value || '').trim().length === 0;
72 isValid = !isWhitespace; 76 isValid = !isWhitespace;
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: [''],
@@ -172,6 +172,33 @@ export class UsersList implements OnInit, AfterViewChecked { @@ -172,6 +172,33 @@ export class UsersList implements OnInit, AfterViewChecked {
172 172
173 //this.GetUserList(); 173 //this.GetUserList();
174 } 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 + }
175 handleChange(evt) { 202 handleChange(evt) {
176 var target = evt.target; 203 var target = evt.target;
177 if (target.value == 'true') { 204 if (target.value == 'true') {
400-SOURCECODE/Admin/src/assets/data/Menu.json
@@ -87,6 +87,12 @@ @@ -87,6 +87,12 @@
87 "SubMenuStatus": "True" 87 "SubMenuStatus": "True"
88 }, 88 },
89 { 89 {
  90 + "SubMenuId": "224",
  91 + "SubMenuName": "Add General Admin",
  92 + "SubMenuUrl": "addgeneral",
  93 + "SubMenuStatus": "True"
  94 + },
  95 + {
90 "SubMenuId": "209", 96 "SubMenuId": "209",
91 "SubMenuName": "Unblock User", 97 "SubMenuName": "Unblock User",
92 "SubMenuUrl": "unblockuser", 98 "SubMenuUrl": "unblockuser",
@@ -294,6 +300,12 @@ @@ -294,6 +300,12 @@
294 "SubMenuStatus": "True" 300 "SubMenuStatus": "True"
295 }, 301 },
296 { 302 {
  303 + "SubMenuId": "224",
  304 + "SubMenuName": "Add General Admin",
  305 + "SubMenuUrl": "addgeneral",
  306 + "SubMenuStatus": "True"
  307 + },
  308 + {
297 "SubMenuId": "209", 309 "SubMenuId": "209",
298 "SubMenuName": "Unblock User", 310 "SubMenuName": "Unblock User",
299 "SubMenuUrl": "unblockuser", 311 "SubMenuUrl": "unblockuser",