Commit 7b4bdba9aaa832f3ea18fa473c56d370b8b013ae
1 parent
b07beb87
phone format and other issue fixed
Showing
10 changed files
with
214 additions
and
113 deletions
400-SOURCECODE/AIAHTML5.ADMIN.API/Web.config
@@ -64,8 +64,8 @@ | @@ -64,8 +64,8 @@ | ||
64 | </assemblyBinding> | 64 | </assemblyBinding> |
65 | </runtime> | 65 | </runtime> |
66 | <connectionStrings> | 66 | <connectionStrings> |
67 | - <add name="AIADatabaseV5Entities1" connectionString="metadata=res://*/Entity.AIADBEntity.csdl|res://*/Entity.AIADBEntity.ssdl|res://*/Entity.AIADBEntity.msl;provider=System.Data.SqlClient;provider connection string="data source=LAPTOP-BIRU-PC\SQLEXPRESS;initial catalog=AIADatabaseV5;user id=aia_dev;password=india123;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" /> | ||
68 | - <add name="AIADatabaseV5Entities" connectionString="metadata=res://*/Entity.AIADBEntity.csdl|res://*/Entity.AIADBEntity.ssdl|res://*/Entity.AIADBEntity.msl;provider=System.Data.SqlClient;provider connection string="data source=LAPTOP-BIRU-PC\SQLEXPRESS;initial catalog=AIADatabaseV5;persist security info=True;user id=aia_dev;password=india123;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" /> | 67 | + <add name="AIADatabaseV5Entities1" connectionString="metadata=res://*/Entity.AIADBEntity.csdl|res://*/Entity.AIADBEntity.ssdl|res://*/Entity.AIADBEntity.msl;provider=System.Data.SqlClient;provider connection string="data source=192.168.90.53;initial catalog=AIADatabaseV5;user id=aia_dev;password=india123;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" /> |
68 | + <add name="AIADatabaseV5Entities" connectionString="metadata=res://*/Entity.AIADBEntity.csdl|res://*/Entity.AIADBEntity.ssdl|res://*/Entity.AIADBEntity.msl;provider=System.Data.SqlClient;provider connection string="data source=192.168.90.53;initial catalog=AIADatabaseV5;persist security info=True;user id=aia_dev;password=india123;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" /> | ||
69 | </connectionStrings> | 69 | </connectionStrings> |
70 | <entityFramework> | 70 | <entityFramework> |
71 | <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> | 71 | <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> |
400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj
@@ -178,7 +178,7 @@ | @@ -178,7 +178,7 @@ | ||
178 | <VisualStudio> | 178 | <VisualStudio> |
179 | <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> | 179 | <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> |
180 | <WebProjectProperties> | 180 | <WebProjectProperties> |
181 | - <UseIIS>True</UseIIS> | 181 | + <UseIIS>False</UseIIS> |
182 | <AutoAssignPort>True</AutoAssignPort> | 182 | <AutoAssignPort>True</AutoAssignPort> |
183 | <DevelopmentServerPort>63874</DevelopmentServerPort> | 183 | <DevelopmentServerPort>63874</DevelopmentServerPort> |
184 | <DevelopmentServerVPath>/</DevelopmentServerVPath> | 184 | <DevelopmentServerVPath>/</DevelopmentServerVPath> |
400-SOURCECODE/AIAHTML5.API/Web.config
@@ -63,9 +63,8 @@ | @@ -63,9 +63,8 @@ | ||
63 | <add key="Aod_site_Url" value="https://uat.adamondemand.com/"/> | 63 | <add key="Aod_site_Url" value="https://uat.adamondemand.com/"/> |
64 | <add key="aiapasskey" value="as@2$eDu8Jk"/> | 64 | <add key="aiapasskey" value="as@2$eDu8Jk"/> |
65 | 65 | ||
66 | - <!--<add key ="AIADatabaseV5Context" value="Data Source=192.168.90.53;Initial Catalog=AIADatabaseV5;User ID=AIA_Dev;Password=india123;"/>--> | ||
67 | - <add key ="AIADatabaseV5Context" value="Data Source=LAPTOP-BIRU-PC\SQLEXPRESS;Initial Catalog=AIADatabaseV5;User ID=AIA_Dev;Password=india123;"/> | ||
68 | - | 66 | + <add key ="AIADatabaseV5Context" value="Data Source=192.168.90.53;Initial Catalog=AIADatabaseV5;User ID=AIA_Dev;Password=india123;"/> |
67 | + | ||
69 | </appSettings> | 68 | </appSettings> |
70 | 69 | ||
71 | 70 |
400-SOURCECODE/Admin/src/app/app.component.ts
@@ -33,6 +33,8 @@ export class AppComponent implements OnInit { | @@ -33,6 +33,8 @@ export class AppComponent implements OnInit { | ||
33 | public submenustaus: string; | 33 | public submenustaus: string; |
34 | public UpdateProfileVisible: boolean; | 34 | public UpdateProfileVisible: boolean; |
35 | public UserManageRightsList: Array<UserManageRightsModel>; | 35 | public UserManageRightsList: Array<UserManageRightsModel>; |
36 | + | ||
37 | + public LicenseTypeId:any; | ||
36 | 38 | ||
37 | constructor(private idle: Idle, private keepalive: Keepalive,private titleService: Title,private _confirmService: ConfirmService,private userservice: UserService,private _loadingService: LoadingService, public global: GlobalService, private router: Router,) { | 39 | constructor(private idle: Idle, private keepalive: Keepalive,private titleService: Title,private _confirmService: ConfirmService,private userservice: UserService,private _loadingService: LoadingService, public global: GlobalService, private router: Router,) { |
38 | const projectTitle= this.titleService.getTitle(); | 40 | const projectTitle= this.titleService.getTitle(); |
@@ -95,7 +97,26 @@ export class AppComponent implements OnInit { | @@ -95,7 +97,26 @@ export class AppComponent implements OnInit { | ||
95 | ngOnInit(): void { | 97 | ngOnInit(): void { |
96 | this.menustaus = "True"; | 98 | this.menustaus = "True"; |
97 | this.global.getJSON().subscribe(data => { | 99 | this.global.getJSON().subscribe(data => { |
98 | - this.obj = data["AdminSections"] | 100 | + this.obj = data["AdminSections"] ; |
101 | + this.LicenseTypeId=this.global.LicenseTypeId; | ||
102 | + if(this.LicenseTypeId !=undefined && this.LicenseTypeId!=0 && this.global.UserTypeName=="Client Admin") | ||
103 | + { | ||
104 | + if(this.obj[2].UserType=="Client Admin") | ||
105 | + { | ||
106 | + var mainsection=this.obj[2]; | ||
107 | + var clientadminSection=mainsection.HeaderMenu[4]; | ||
108 | + var siteUageReportSection=clientadminSection.SubMenu[6]; | ||
109 | + var concurrentLicenseId=siteUageReportSection.LicenseTypeId; | ||
110 | + | ||
111 | + //do not show this report for concurrent license of client admin | ||
112 | + if(concurrentLicenseId ==this.LicenseTypeId) | ||
113 | + { | ||
114 | + siteUageReportSection.SubMenuStatus="False"; | ||
115 | + } | ||
116 | + } | ||
117 | + } | ||
118 | + | ||
119 | + | ||
99 | for (let i = 0; i < 7; i++) { | 120 | for (let i = 0; i < 7; i++) { |
100 | if (this.obj[i].Id == this.global.UserType) { | 121 | if (this.obj[i].Id == this.global.UserType) { |
101 | if (this.global.UserTypeName == "General Admin") { | 122 | if (this.global.UserTypeName == "General Admin") { |
400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.html
@@ -242,6 +242,7 @@ | @@ -242,6 +242,7 @@ | ||
242 | {{item.StateName}} | 242 | {{item.StateName}} |
243 | </option> | 243 | </option> |
244 | </select> | 244 | </select> |
245 | + <div *ngIf="insertUpdateLicenseFrm.get('stateId').hasError('min')" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">State is required</div> | ||
245 | </div> | 246 | </div> |
246 | </div> | 247 | </div> |
247 | </div> | 248 | </div> |
@@ -277,7 +278,7 @@ | @@ -277,7 +278,7 @@ | ||
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 | <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"> | 279 | <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" (keyup)="onKeyUp($event)" (keydown.space)="$event.preventDefault();"> | 280 | <input type="text" class="form-control input-sm" id="Phone" formControlName="phone" maxlength="30" (keyup)="onKeyUp($event)" (keydown.space)="$event.preventDefault();"> |
280 | - <span class="help-block">(xxx-xxx-xxxx)</span> | 281 | + <span *ngIf="IsUniteState" 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> | 282 | <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> | 283 | <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> |
283 | </div> | 284 | </div> |
400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.ts
@@ -50,6 +50,7 @@ export class AddLicense implements OnInit { | @@ -50,6 +50,7 @@ export class AddLicense implements OnInit { | ||
50 | dateStartInvalid: boolean = false; | 50 | dateStartInvalid: boolean = false; |
51 | dateEndInvalid: boolean = false; | 51 | dateEndInvalid: boolean = false; |
52 | dateRenewInvalid: boolean = false; | 52 | dateRenewInvalid: boolean = false; |
53 | + IsUniteState:Boolean=false; | ||
53 | NumberOfRows:number=0; | 54 | NumberOfRows:number=0; |
54 | constructor(private _loadingService: LoadingService,private licenseService: LicenseService, private globalService: GlobalService, | 55 | constructor(private _loadingService: LoadingService,private licenseService: LicenseService, private globalService: GlobalService, |
55 | private router: Router, private activeRoute: ActivatedRoute, | 56 | private router: Router, private activeRoute: ActivatedRoute, |
@@ -76,11 +77,12 @@ export class AddLicense implements OnInit { | @@ -76,11 +77,12 @@ export class AddLicense implements OnInit { | ||
76 | address1: ['', [Validators.required,this.noWhitespaceValidator]], | 77 | address1: ['', [Validators.required,this.noWhitespaceValidator]], |
77 | address2: [''], | 78 | address2: [''], |
78 | city: ['', [Validators.required,this.noWhitespaceValidator]], | 79 | city: ['', [Validators.required,this.noWhitespaceValidator]], |
79 | - stateId: [0, Validators.min(1)], | 80 | + stateId: [0, [Validators.min(1)]], |
80 | countryId: [0, Validators.min(1)], | 81 | countryId: [0, Validators.min(1)], |
81 | zip: ['', [Validators.required]], | 82 | zip: ['', [Validators.required]], |
82 | emailId: ['', [Validators.required]], | 83 | emailId: ['', [Validators.required]], |
83 | - phone: ['', [Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]], | 84 | + //phone: ['', [Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]], |
85 | + phone: ['', [Validators.required]], | ||
84 | editionLoginArr: this.fb.array([]), | 86 | editionLoginArr: this.fb.array([]), |
85 | editionLogins: [''], | 87 | editionLogins: [''], |
86 | totalLogins: [0], | 88 | totalLogins: [0], |
@@ -198,47 +200,86 @@ export class AddLicense implements OnInit { | @@ -198,47 +200,86 @@ export class AddLicense implements OnInit { | ||
198 | 200 | ||
199 | onKeyUp(event: any) { | 201 | onKeyUp(event: any) { |
200 | var mobno = event.target.value; | 202 | var mobno = event.target.value; |
201 | - var newnum=mobno; | ||
202 | - if(mobno!="" && event.key!="Backspace") | 203 | + var countryName =$("#Country option:selected").text().trim(); |
204 | + | ||
205 | + if(mobno!="" && event.key!="Backspace") | ||
206 | + { | ||
207 | + if(countryName=="United States") | ||
208 | + { | ||
209 | + this.USFormatPhoneNumber(mobno); | ||
210 | + } | ||
211 | + else | ||
203 | { | 212 | { |
204 | - var tempArr = mobno.split('-'); | ||
205 | - | ||
206 | - if(tempArr.length==1) | ||
207 | - { | ||
208 | - var countdigit=tempArr[0].length; | ||
209 | - newnum=tempArr[0]; | ||
210 | - if(countdigit==3) | ||
211 | - { | ||
212 | - newnum=tempArr[0]+"-"; | ||
213 | - } | ||
214 | - else if(countdigit>3) | ||
215 | - { | ||
216 | - newnum=tempArr[0].substr(0,3)+"-"+tempArr[0].substr(3,1); | ||
217 | - } | ||
218 | - | ||
219 | - } | ||
220 | - else if(tempArr.length==2) | ||
221 | - { | ||
222 | - newnum=tempArr[0]+"-"+tempArr[1]; | ||
223 | - var countdigit=tempArr[1].length; | ||
224 | - if(countdigit==3) | ||
225 | - { | ||
226 | - newnum=tempArr[0]+"-"+tempArr[1]+"-"; | ||
227 | - } | ||
228 | - else if(countdigit>3) | ||
229 | - { | ||
230 | - newnum= tempArr[0]+"-"+tempArr[1].substr(0,3)+"-"+tempArr[1].substr(3,1); | ||
231 | - } | ||
232 | - } | ||
233 | - else | ||
234 | - { | ||
235 | - newnum=tempArr[0]+"-"+tempArr[1]+"-"+tempArr[2]; | ||
236 | - } | ||
237 | - | 213 | + this.OtherFormatPhoneNumber(mobno); |
214 | + } | ||
238 | } | 215 | } |
239 | - this.insertUpdateLicenseFrm.controls['phone'].setValue(newnum); | ||
240 | }; | 216 | }; |
241 | 217 | ||
218 | + | ||
219 | +OtherFormatPhoneNumber(mobno:any) | ||
220 | +{ | ||
221 | + //var regex = /\d+/g; | ||
222 | + //var matches = mobno.match(regex); //extract digit only | ||
223 | + //var currentNum= matches==null?"" :matches.join(''); | ||
224 | + this.insertUpdateLicenseFrm.controls['phone'].setValue(mobno); | ||
225 | +} | ||
226 | + | ||
227 | +USFormatPhoneNumber(mobno:any) | ||
228 | +{ | ||
229 | + var newformat=""; | ||
230 | + if(mobno!="" && mobno!=null) | ||
231 | + { | ||
232 | + var regex = /\d+/g; | ||
233 | + var matches = mobno.match(regex); //extract digit only | ||
234 | + var currentNum= matches==null?"" :matches.join(''); | ||
235 | + | ||
236 | + for(var ind=0;ind<currentNum.length;ind++) | ||
237 | + { | ||
238 | + if(newformat.length==3) | ||
239 | + { | ||
240 | + newformat=newformat+"-"; | ||
241 | + } | ||
242 | + else if(newformat.length==7) | ||
243 | + { | ||
244 | + newformat=newformat+"-"; | ||
245 | + } | ||
246 | + newformat=newformat+currentNum[ind]; | ||
247 | + } | ||
248 | + | ||
249 | + } | ||
250 | + this.insertUpdateLicenseFrm.controls['phone'].setValue(newformat); | ||
251 | +} | ||
252 | + | ||
253 | +//get Property | ||
254 | +get PhoneNumber() { | ||
255 | + return this.insertUpdateLicenseFrm.get('phone'); | ||
256 | +} | ||
257 | + | ||
258 | +UpdatePhoneValidation() | ||
259 | +{ | ||
260 | + var phoneno=this.PhoneNumber.value==null?"":this.PhoneNumber.value; | ||
261 | + | ||
262 | + var countryName =$("#Country option:selected").text().trim(); | ||
263 | + if(countryName=="United States") | ||
264 | + { | ||
265 | + // validate first phone number | ||
266 | + this.IsUniteState=true; | ||
267 | + | ||
268 | + this.PhoneNumber.setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]); | ||
269 | + this.PhoneNumber.updateValueAndValidity(); | ||
270 | + this.USFormatPhoneNumber(phoneno); | ||
271 | + } | ||
272 | + else | ||
273 | + { | ||
274 | + this.IsUniteState=false; | ||
275 | + // this.PhoneNumber.setValidators([Validators.required, Validators.pattern('^[0-9]*$')]); | ||
276 | + this.PhoneNumber.setValidators([Validators.required]); | ||
277 | + this.PhoneNumber.updateValueAndValidity(); | ||
278 | + this.OtherFormatPhoneNumber(phoneno); | ||
279 | + } | ||
280 | + | ||
281 | +} | ||
282 | + | ||
242 | openModal(template: TemplateRef<any>) { | 283 | openModal(template: TemplateRef<any>) { |
243 | this.modalRef = this.modalService.show(template); | 284 | this.modalRef = this.modalService.show(template); |
244 | } | 285 | } |
@@ -469,15 +510,9 @@ export class AddLicense implements OnInit { | @@ -469,15 +510,9 @@ export class AddLicense implements OnInit { | ||
469 | this.insertUpdateLicenseFrm.controls['isActive'].setValue('false'); | 510 | this.insertUpdateLicenseFrm.controls['isActive'].setValue('false'); |
470 | } | 511 | } |
471 | 512 | ||
472 | - // this.insertUpdateLicenseFrm.controls['phone'].clearValidators(); | ||
473 | - // if (this.lstCountry.find(C => C.Id == this.license.CountryId).CountryName != "United States") { | ||
474 | - // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required,this.noWhitespaceValidator]); | ||
475 | - // } | ||
476 | - // else { | ||
477 | - // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$'),this.noWhitespaceValidator]); | ||
478 | - // } | ||
479 | - // this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity(); | ||
480 | this.insertUpdateLicenseFrm.controls['phone'].setValue(this.license.Phone); | 513 | this.insertUpdateLicenseFrm.controls['phone'].setValue(this.license.Phone); |
514 | + // validate first phone number | ||
515 | + this.UpdatePhoneValidation(); | ||
481 | 516 | ||
482 | if (this.license.EditionLogins == null) return; | 517 | if (this.license.EditionLogins == null) return; |
483 | var TempArr = this.license.EditionLogins.split('|'); | 518 | var TempArr = this.license.EditionLogins.split('|'); |
@@ -774,16 +809,12 @@ export class AddLicense implements OnInit { | @@ -774,16 +809,12 @@ export class AddLicense implements OnInit { | ||
774 | if (this.lstCountry.find(C => C.Id == this.license.CountryId).CountryName != "United States") { | 809 | if (this.lstCountry.find(C => C.Id == this.license.CountryId).CountryName != "United States") { |
775 | this.license.StateId = this.lstState.find(C => C.StateName == "Other").Id; | 810 | this.license.StateId = this.lstState.find(C => C.StateName == "Other").Id; |
776 | this.insertUpdateLicenseFrm.controls['stateId'].setValue(this.license.StateId); | 811 | this.insertUpdateLicenseFrm.controls['stateId'].setValue(this.license.StateId); |
777 | - // this.insertUpdateLicenseFrm.controls['phone'].clearValidators(); | ||
778 | - // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required,this.noWhitespaceValidator]); | ||
779 | } | 812 | } |
780 | else { | 813 | else { |
781 | this.license.StateId = 0; | 814 | this.license.StateId = 0; |
782 | this.insertUpdateLicenseFrm.controls['stateId'].setValue(this.license.StateId); | 815 | this.insertUpdateLicenseFrm.controls['stateId'].setValue(this.license.StateId); |
783 | - // this.insertUpdateLicenseFrm.controls['phone'].clearValidators(); | ||
784 | - // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$'),this.noWhitespaceValidator]); | ||
785 | } | 816 | } |
786 | - //this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity(); | 817 | + this.UpdatePhoneValidation(); |
787 | } | 818 | } |
788 | 819 | ||
789 | OnStateChange(element: any) { | 820 | OnStateChange(element: any) { |
@@ -791,16 +822,11 @@ export class AddLicense implements OnInit { | @@ -791,16 +822,11 @@ export class AddLicense implements OnInit { | ||
791 | if (this.lstState.find(C => C.Id == this.license.StateId).StateName != "Other") { | 822 | if (this.lstState.find(C => C.Id == this.license.StateId).StateName != "Other") { |
792 | this.license.CountryId = this.lstCountry.find(C => C.CountryName == "United States").Id; | 823 | this.license.CountryId = this.lstCountry.find(C => C.CountryName == "United States").Id; |
793 | this.insertUpdateLicenseFrm.controls['countryId'].setValue(this.license.CountryId); | 824 | this.insertUpdateLicenseFrm.controls['countryId'].setValue(this.license.CountryId); |
794 | - // this.insertUpdateLicenseFrm.controls['phone'].clearValidators(); | ||
795 | - // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$'),this.noWhitespaceValidator]); | ||
796 | } | 825 | } |
797 | else { | 826 | else { |
798 | this.license.CountryId = 0; | 827 | this.license.CountryId = 0; |
799 | this.insertUpdateLicenseFrm.controls['countryId'].setValue(this.license.CountryId); | 828 | this.insertUpdateLicenseFrm.controls['countryId'].setValue(this.license.CountryId); |
800 | - // this.insertUpdateLicenseFrm.controls['phone'].clearValidators(); | ||
801 | - // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required,this.noWhitespaceValidator]); | ||
802 | - } | ||
803 | - // this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity(); | 829 | + } |
804 | } | 830 | } |
805 | 831 | ||
806 | SubscriptionPriceBlur() { | 832 | SubscriptionPriceBlur() { |
400-SOURCECODE/Admin/src/app/components/LicenseEntity/editlicensebasicsettings.component.html
@@ -122,15 +122,16 @@ | @@ -122,15 +122,16 @@ | ||
122 | {{item.StateName}} | 122 | {{item.StateName}} |
123 | </option> | 123 | </option> |
124 | </select> | 124 | </select> |
125 | + <div *ngIf="updateLicenseBasicSettingsFrm.get('stateId').hasError('min')" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">State is required</div> | ||
125 | </div> | 126 | </div> |
126 | </div> | 127 | </div> |
127 | 128 | ||
128 | <div class="form-group"> | 129 | <div class="form-group"> |
129 | <label for="inputEmail3" class="col-sm-4 control-label">Country <span class="red">*</span> :</label> | 130 | <label for="inputEmail3" class="col-sm-4 control-label">Country <span class="red">*</span> :</label> |
130 | <div class="col-sm-7"> | 131 | <div class="col-sm-7"> |
131 | - <select class="form-control input-sm" id="Country" formControlName="countryId"> | 132 | + <select class="form-control input-sm" id="Country" formControlName="countryId" (change)="onCountryChange($event)"> |
132 | <option value="0">Select</option> | 133 | <option value="0">Select</option> |
133 | - <option *ngFor="let item of lstCountry" value="{{item.Id}}"> | 134 | + <option *ngFor="let item of lstCountry" [value]="item.Id"> |
134 | {{item.CountryName}} | 135 | {{item.CountryName}} |
135 | </option> | 136 | </option> |
136 | </select> | 137 | </select> |
@@ -138,12 +139,12 @@ | @@ -138,12 +139,12 @@ | ||
138 | </div> | 139 | </div> |
139 | 140 | ||
140 | <div class="form-group"> | 141 | <div class="form-group"> |
141 | - <label for="inputEmail3" class="col-sm-4 control-label">Phone <span class="red">*</span> :</label> | 142 | + <label for="Phone" class="col-sm-4 control-label">Phone <span class="red">*</span> :</label> |
142 | <div class="col-sm-7"> | 143 | <div class="col-sm-7"> |
143 | <input type="text" class="form-control input-sm" id="Phone" formControlName="phone" maxlength="30" (keyup)="onKeyUp($event)" (keydown.space)="$event.preventDefault();"> | 144 | <input type="text" class="form-control input-sm" id="Phone" formControlName="phone" maxlength="30" (keyup)="onKeyUp($event)" (keydown.space)="$event.preventDefault();"> |
144 | - <span class="help-block">(xxx-xxx-xxxx)</span> | 145 | + <span *ngIf="IsUniteState" class="help-block">(xxx-xxx-xxxx)</span> |
145 | <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> | 146 | <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> |
146 | - <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> | 147 | + <div *ngIf="updateLicenseBasicSettingsFrm.controls.phone.hasError('pattern') && (updateLicenseBasicSettingsFrm.controls.phone.dirty||license.LicenseId)" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Phone is invalid</div> |
147 | </div> | 148 | </div> |
148 | </div> | 149 | </div> |
149 | 150 |
400-SOURCECODE/Admin/src/app/components/LicenseEntity/editlicensebasicsettings.component.ts
@@ -32,6 +32,7 @@ export class EditLicenseBasicSettings implements OnInit { | @@ -32,6 +32,7 @@ export class EditLicenseBasicSettings implements OnInit { | ||
32 | MinusCharater: number; | 32 | MinusCharater: number; |
33 | LicenseId:number=0; | 33 | LicenseId:number=0; |
34 | AccountNumber:string=''; | 34 | AccountNumber:string=''; |
35 | + IsUniteState:Boolean=false; | ||
35 | 36 | ||
36 | constructor(private _loadingService: LoadingService,private licenseService: LicenseService, | 37 | constructor(private _loadingService: LoadingService,private licenseService: LicenseService, |
37 | public globalService: GlobalService, private router: Router, | 38 | public globalService: GlobalService, private router: Router, |
@@ -53,11 +54,12 @@ export class EditLicenseBasicSettings implements OnInit { | @@ -53,11 +54,12 @@ export class EditLicenseBasicSettings implements OnInit { | ||
53 | address1: ['', [Validators.required,this.noWhitespaceValidator]], | 54 | address1: ['', [Validators.required,this.noWhitespaceValidator]], |
54 | address2: [''], | 55 | address2: [''], |
55 | city: ['', [Validators.required,this.noWhitespaceValidator]], | 56 | city: ['', [Validators.required,this.noWhitespaceValidator]], |
56 | - stateId: [0], | 57 | + stateId: [0, [Validators.min(1)]], |
57 | countryId: [0], | 58 | countryId: [0], |
58 | zip: ['', [Validators.required]], | 59 | zip: ['', [Validators.required]], |
59 | emailId: ['', [Validators.required]], | 60 | emailId: ['', [Validators.required]], |
60 | - phone: ['', [Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]], | 61 | + //phone: ['', [Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]], |
62 | + phone: ['', [Validators.required]] | ||
61 | }); | 63 | }); |
62 | this.GetCountry(); | 64 | this.GetCountry(); |
63 | this.GetState(); | 65 | this.GetState(); |
@@ -114,57 +116,100 @@ export class EditLicenseBasicSettings implements OnInit { | @@ -114,57 +116,100 @@ export class EditLicenseBasicSettings implements OnInit { | ||
114 | return isValid ? null: { 'whitespace': true }; | 116 | return isValid ? null: { 'whitespace': true }; |
115 | 117 | ||
116 | } | 118 | } |
119 | + | ||
117 | onKeyUp(event: any) { | 120 | onKeyUp(event: any) { |
118 | var mobno = event.target.value; | 121 | var mobno = event.target.value; |
119 | - var newnum=mobno; | ||
120 | - if(mobno!="" && event.key!="Backspace") | 122 | + var countryName =$("#Country option:selected").text().trim(); |
123 | + if(mobno!="" && event.key!="Backspace") | ||
124 | + { | ||
125 | + if(countryName=="United States") | ||
126 | + { | ||
127 | + this.USFormatPhoneNumber(mobno); | ||
128 | + } | ||
129 | + else | ||
121 | { | 130 | { |
122 | - var tempArr = mobno.split('-'); | ||
123 | - | ||
124 | - if(tempArr.length==1) | ||
125 | - { | ||
126 | - var countdigit=tempArr[0].length; | ||
127 | - newnum=tempArr[0]; | ||
128 | - if(countdigit==3) | ||
129 | - { | ||
130 | - newnum=tempArr[0]+"-"; | ||
131 | - } | ||
132 | - else if(countdigit>3) | ||
133 | - { | ||
134 | - newnum=tempArr[0].substr(0,3)+"-"+tempArr[0].substr(3,1); | ||
135 | - } | ||
136 | - | ||
137 | - } | ||
138 | - else if(tempArr.length==2) | ||
139 | - { | ||
140 | - newnum=tempArr[0]+"-"+tempArr[1]; | ||
141 | - var countdigit=tempArr[1].length; | ||
142 | - if(countdigit==3) | ||
143 | - { | ||
144 | - newnum=tempArr[0]+"-"+tempArr[1]+"-"; | ||
145 | - } | ||
146 | - else if(countdigit>3) | ||
147 | - { | ||
148 | - newnum= tempArr[0]+"-"+tempArr[1].substr(0,3)+"-"+tempArr[1].substr(3,1); | ||
149 | - } | ||
150 | - } | ||
151 | - else | ||
152 | - { | ||
153 | - newnum=tempArr[0]+"-"+tempArr[1]+"-"+tempArr[2]; | ||
154 | - } | 131 | + this.OtherFormatPhoneNumber(mobno); |
132 | + } | ||
133 | +} | ||
134 | + | ||
135 | +}; | ||
155 | 136 | ||
156 | - } | ||
157 | - this.updateLicenseBasicSettingsFrm.controls['phone'].setValue(newnum); | ||
158 | - | 137 | +OtherFormatPhoneNumber(mobno:any) |
138 | +{ | ||
139 | + //var regex = /\d+/g; | ||
140 | + //var matches = mobno.match(regex); //extract digit only | ||
141 | + //var currentNum= matches==null?"" :matches.join(''); | ||
142 | + this.updateLicenseBasicSettingsFrm.controls['phone'].setValue(mobno); | ||
143 | +} | ||
144 | + | ||
145 | +USFormatPhoneNumber(mobno:any) | ||
146 | +{ | ||
147 | + var newformat=""; | ||
148 | + if(mobno!="" && mobno!=null) | ||
149 | + { | ||
150 | + var regex = /\d+/g; | ||
151 | + var matches = mobno.match(regex); //extract digit only | ||
152 | + var currentNum= matches==null?"" :matches.join(''); | ||
153 | + | ||
154 | + for(var ind=0;ind<currentNum.length;ind++) | ||
155 | + { | ||
156 | + if(newformat.length==3) | ||
157 | + { | ||
158 | + newformat=newformat+"-"; | ||
159 | + } | ||
160 | + else if(newformat.length==7) | ||
161 | + { | ||
162 | + newformat=newformat+"-"; | ||
163 | + } | ||
164 | + newformat=newformat+currentNum[ind]; | ||
165 | + } | ||
166 | + | ||
167 | + } | ||
168 | + this.updateLicenseBasicSettingsFrm.controls['phone'].setValue(newformat); | ||
169 | +} | ||
170 | + | ||
171 | +//get Property | ||
172 | +get PhoneNumber() { | ||
173 | + return this.updateLicenseBasicSettingsFrm.get('phone'); | ||
174 | +} | ||
175 | +onCountryChange(event: any) { | ||
176 | + //let contryName = event.target.options[event.target.options.selectedIndex].text; | ||
177 | + this.UpdatePhoneValidation() | ||
159 | }; | 178 | }; |
160 | 179 | ||
180 | +UpdatePhoneValidation() | ||
181 | +{ | ||
182 | + var phoneno=this.PhoneNumber.value==null?"":this.PhoneNumber.value; | ||
183 | + | ||
184 | + var countryName =$("#Country option:selected").text().trim(); | ||
185 | + if(countryName=="United States") | ||
186 | + { | ||
187 | + // validate first phone number | ||
188 | + this.IsUniteState=true; | ||
189 | + this.PhoneNumber.setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]); | ||
190 | + this.PhoneNumber.updateValueAndValidity(); | ||
191 | + this.USFormatPhoneNumber(phoneno); | ||
192 | + } | ||
193 | + else | ||
194 | + { | ||
195 | + this.IsUniteState=false; | ||
196 | + // this.PhoneNumber.setValidators([Validators.required, Validators.pattern('^[0-9]*$')]); | ||
197 | + this.PhoneNumber.setValidators([Validators.required]); | ||
198 | + this.PhoneNumber.updateValueAndValidity(); | ||
199 | + this.OtherFormatPhoneNumber(phoneno); | ||
200 | + } | ||
201 | + | ||
202 | +} | ||
203 | + | ||
161 | openModal(template: TemplateRef<any>) { | 204 | openModal(template: TemplateRef<any>) { |
162 | this.modalRef = this.modalService.show(template); | 205 | this.modalRef = this.modalService.show(template); |
163 | } | 206 | } |
164 | 207 | ||
165 | GetCountry() { | 208 | GetCountry() { |
166 | this.licenseService.GetCountry() | 209 | this.licenseService.GetCountry() |
167 | - .subscribe(y => { this.lstCountry = y; }, error => this.error = <any>error); | 210 | + .subscribe(y => { |
211 | + this.lstCountry = y; | ||
212 | + }, error => this.error = <any>error); | ||
168 | } | 213 | } |
169 | 214 | ||
170 | GetState() { | 215 | GetState() { |
@@ -207,6 +252,8 @@ export class EditLicenseBasicSettings implements OnInit { | @@ -207,6 +252,8 @@ export class EditLicenseBasicSettings implements OnInit { | ||
207 | this.updateLicenseBasicSettingsFrm.controls['emailId'].setValue(this.license.EmailId); | 252 | this.updateLicenseBasicSettingsFrm.controls['emailId'].setValue(this.license.EmailId); |
208 | this.updateLicenseBasicSettingsFrm.controls['phone'].setValue(this.license.Phone); | 253 | this.updateLicenseBasicSettingsFrm.controls['phone'].setValue(this.license.Phone); |
209 | this._loadingService.HideLoading("global-loading"); | 254 | this._loadingService.HideLoading("global-loading"); |
255 | + | ||
256 | + this.UpdatePhoneValidation(); | ||
210 | }, | 257 | }, |
211 | error => this.error = <any>error); | 258 | error => this.error = <any>error); |
212 | } | 259 | } |
400-SOURCECODE/Admin/src/app/shared/global.ts
@@ -30,6 +30,7 @@ export class GlobalService { | @@ -30,6 +30,7 @@ export class GlobalService { | ||
30 | SessionId:number=0; | 30 | SessionId:number=0; |
31 | isSiteUser:boolean=false; | 31 | isSiteUser:boolean=false; |
32 | isAdmin:boolean=false; | 32 | isAdmin:boolean=false; |
33 | + LicenseTypeId:number=0; | ||
33 | RemoveColumns: Array<string> = ["Serial_No", "LicenseId","RowNum"] | 34 | RemoveColumns: Array<string> = ["Serial_No", "LicenseId","RowNum"] |
34 | error; | 35 | error; |
35 | public href: string = ""; | 36 | public href: string = ""; |
@@ -58,7 +59,11 @@ export class GlobalService { | @@ -58,7 +59,11 @@ export class GlobalService { | ||
58 | this.aiaPingInterval=this.loggedInUser.aiaPingInterval; | 59 | this.aiaPingInterval=this.loggedInUser.aiaPingInterval; |
59 | this.SessionId=this.loggedInUser.SessionId; | 60 | this.SessionId=this.loggedInUser.SessionId; |
60 | this.isSiteUser=this.loggedInUser.isSiteUser; | 61 | this.isSiteUser=this.loggedInUser.isSiteUser; |
61 | - this.isAdmin=this.loggedInUser.LicenseId==0?true:false;; | 62 | + this.isAdmin=this.loggedInUser.LicenseId==0?true:false; |
63 | + | ||
64 | + if (this.loggedInUser.LicenseInfo != null) { | ||
65 | + this.LicenseTypeId=this.loggedInUser.LicenseInfo.LicenseTypeId; | ||
66 | + } | ||
62 | 67 | ||
63 | } | 68 | } |
64 | 69 |
400-SOURCECODE/Admin/src/assets/data/Menu.json
@@ -578,6 +578,7 @@ | @@ -578,6 +578,7 @@ | ||
578 | "SubMenuId": "218", | 578 | "SubMenuId": "218", |
579 | "SubMenuName": "Site License Usage Report", | 579 | "SubMenuName": "Site License Usage Report", |
580 | "SubMenuUrl": "sitelicenseusagereport", | 580 | "SubMenuUrl": "sitelicenseusagereport", |
581 | + "LicenseTypeId": 1, | ||
581 | "SubMenuStatus": "True" | 582 | "SubMenuStatus": "True" |
582 | }, | 583 | }, |
583 | { | 584 | { |