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 | 64 | </assemblyBinding> |
65 | 65 | </runtime> |
66 | 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 | 69 | </connectionStrings> |
70 | 70 | <entityFramework> |
71 | 71 | <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> | ... | ... |
400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj
... | ... | @@ -178,7 +178,7 @@ |
178 | 178 | <VisualStudio> |
179 | 179 | <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> |
180 | 180 | <WebProjectProperties> |
181 | - <UseIIS>True</UseIIS> | |
181 | + <UseIIS>False</UseIIS> | |
182 | 182 | <AutoAssignPort>True</AutoAssignPort> |
183 | 183 | <DevelopmentServerPort>63874</DevelopmentServerPort> |
184 | 184 | <DevelopmentServerVPath>/</DevelopmentServerVPath> | ... | ... |
400-SOURCECODE/AIAHTML5.API/Web.config
... | ... | @@ -63,9 +63,8 @@ |
63 | 63 | <add key="Aod_site_Url" value="https://uat.adamondemand.com/"/> |
64 | 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 | 68 | </appSettings> |
70 | 69 | |
71 | 70 | ... | ... |
400-SOURCECODE/Admin/src/app/app.component.ts
... | ... | @@ -33,6 +33,8 @@ export class AppComponent implements OnInit { |
33 | 33 | public submenustaus: string; |
34 | 34 | public UpdateProfileVisible: boolean; |
35 | 35 | public UserManageRightsList: Array<UserManageRightsModel>; |
36 | + | |
37 | + public LicenseTypeId:any; | |
36 | 38 | |
37 | 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 | 40 | const projectTitle= this.titleService.getTitle(); |
... | ... | @@ -95,7 +97,26 @@ export class AppComponent implements OnInit { |
95 | 97 | ngOnInit(): void { |
96 | 98 | this.menustaus = "True"; |
97 | 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 | 120 | for (let i = 0; i < 7; i++) { |
100 | 121 | if (this.obj[i].Id == this.global.UserType) { |
101 | 122 | if (this.global.UserTypeName == "General Admin") { | ... | ... |
400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.html
... | ... | @@ -242,6 +242,7 @@ |
242 | 242 | {{item.StateName}} |
243 | 243 | </option> |
244 | 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 | 246 | </div> |
246 | 247 | </div> |
247 | 248 | </div> |
... | ... | @@ -277,7 +278,7 @@ |
277 | 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 | 279 | <div class="col-sm-12 col-lg-6 padd-left0 padd-right0"> |
279 | 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 | 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 | 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 | 284 | </div> | ... | ... |
400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.ts
... | ... | @@ -50,6 +50,7 @@ export class AddLicense implements OnInit { |
50 | 50 | dateStartInvalid: boolean = false; |
51 | 51 | dateEndInvalid: boolean = false; |
52 | 52 | dateRenewInvalid: boolean = false; |
53 | + IsUniteState:Boolean=false; | |
53 | 54 | NumberOfRows:number=0; |
54 | 55 | constructor(private _loadingService: LoadingService,private licenseService: LicenseService, private globalService: GlobalService, |
55 | 56 | private router: Router, private activeRoute: ActivatedRoute, |
... | ... | @@ -76,11 +77,12 @@ export class AddLicense implements OnInit { |
76 | 77 | address1: ['', [Validators.required,this.noWhitespaceValidator]], |
77 | 78 | address2: [''], |
78 | 79 | city: ['', [Validators.required,this.noWhitespaceValidator]], |
79 | - stateId: [0, Validators.min(1)], | |
80 | + stateId: [0, [Validators.min(1)]], | |
80 | 81 | countryId: [0, Validators.min(1)], |
81 | 82 | zip: ['', [Validators.required]], |
82 | 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 | 86 | editionLoginArr: this.fb.array([]), |
85 | 87 | editionLogins: [''], |
86 | 88 | totalLogins: [0], |
... | ... | @@ -198,47 +200,86 @@ export class AddLicense implements OnInit { |
198 | 200 | |
199 | 201 | onKeyUp(event: any) { |
200 | 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 | 283 | openModal(template: TemplateRef<any>) { |
243 | 284 | this.modalRef = this.modalService.show(template); |
244 | 285 | } |
... | ... | @@ -469,15 +510,9 @@ export class AddLicense implements OnInit { |
469 | 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 | 513 | this.insertUpdateLicenseFrm.controls['phone'].setValue(this.license.Phone); |
514 | + // validate first phone number | |
515 | + this.UpdatePhoneValidation(); | |
481 | 516 | |
482 | 517 | if (this.license.EditionLogins == null) return; |
483 | 518 | var TempArr = this.license.EditionLogins.split('|'); |
... | ... | @@ -774,16 +809,12 @@ export class AddLicense implements OnInit { |
774 | 809 | if (this.lstCountry.find(C => C.Id == this.license.CountryId).CountryName != "United States") { |
775 | 810 | this.license.StateId = this.lstState.find(C => C.StateName == "Other").Id; |
776 | 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 | 813 | else { |
781 | 814 | this.license.StateId = 0; |
782 | 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 | 820 | OnStateChange(element: any) { |
... | ... | @@ -791,16 +822,11 @@ export class AddLicense implements OnInit { |
791 | 822 | if (this.lstState.find(C => C.Id == this.license.StateId).StateName != "Other") { |
792 | 823 | this.license.CountryId = this.lstCountry.find(C => C.CountryName == "United States").Id; |
793 | 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 | 826 | else { |
798 | 827 | this.license.CountryId = 0; |
799 | 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 | 832 | SubscriptionPriceBlur() { | ... | ... |
400-SOURCECODE/Admin/src/app/components/LicenseEntity/editlicensebasicsettings.component.html
... | ... | @@ -122,15 +122,16 @@ |
122 | 122 | {{item.StateName}} |
123 | 123 | </option> |
124 | 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 | 126 | </div> |
126 | 127 | </div> |
127 | 128 | |
128 | 129 | <div class="form-group"> |
129 | 130 | <label for="inputEmail3" class="col-sm-4 control-label">Country <span class="red">*</span> :</label> |
130 | 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 | 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 | 135 | {{item.CountryName}} |
135 | 136 | </option> |
136 | 137 | </select> |
... | ... | @@ -138,12 +139,12 @@ |
138 | 139 | </div> |
139 | 140 | |
140 | 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 | 143 | <div class="col-sm-7"> |
143 | 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 | 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 | 148 | </div> |
148 | 149 | </div> |
149 | 150 | ... | ... |
400-SOURCECODE/Admin/src/app/components/LicenseEntity/editlicensebasicsettings.component.ts
... | ... | @@ -32,6 +32,7 @@ export class EditLicenseBasicSettings implements OnInit { |
32 | 32 | MinusCharater: number; |
33 | 33 | LicenseId:number=0; |
34 | 34 | AccountNumber:string=''; |
35 | + IsUniteState:Boolean=false; | |
35 | 36 | |
36 | 37 | constructor(private _loadingService: LoadingService,private licenseService: LicenseService, |
37 | 38 | public globalService: GlobalService, private router: Router, |
... | ... | @@ -53,11 +54,12 @@ export class EditLicenseBasicSettings implements OnInit { |
53 | 54 | address1: ['', [Validators.required,this.noWhitespaceValidator]], |
54 | 55 | address2: [''], |
55 | 56 | city: ['', [Validators.required,this.noWhitespaceValidator]], |
56 | - stateId: [0], | |
57 | + stateId: [0, [Validators.min(1)]], | |
57 | 58 | countryId: [0], |
58 | 59 | zip: ['', [Validators.required]], |
59 | 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 | 64 | this.GetCountry(); |
63 | 65 | this.GetState(); |
... | ... | @@ -114,57 +116,100 @@ export class EditLicenseBasicSettings implements OnInit { |
114 | 116 | return isValid ? null: { 'whitespace': true }; |
115 | 117 | |
116 | 118 | } |
119 | + | |
117 | 120 | onKeyUp(event: any) { |
118 | 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 | 204 | openModal(template: TemplateRef<any>) { |
162 | 205 | this.modalRef = this.modalService.show(template); |
163 | 206 | } |
164 | 207 | |
165 | 208 | GetCountry() { |
166 | 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 | 215 | GetState() { |
... | ... | @@ -207,6 +252,8 @@ export class EditLicenseBasicSettings implements OnInit { |
207 | 252 | this.updateLicenseBasicSettingsFrm.controls['emailId'].setValue(this.license.EmailId); |
208 | 253 | this.updateLicenseBasicSettingsFrm.controls['phone'].setValue(this.license.Phone); |
209 | 254 | this._loadingService.HideLoading("global-loading"); |
255 | + | |
256 | + this.UpdatePhoneValidation(); | |
210 | 257 | }, |
211 | 258 | error => this.error = <any>error); |
212 | 259 | } | ... | ... |
400-SOURCECODE/Admin/src/app/shared/global.ts
... | ... | @@ -30,6 +30,7 @@ export class GlobalService { |
30 | 30 | SessionId:number=0; |
31 | 31 | isSiteUser:boolean=false; |
32 | 32 | isAdmin:boolean=false; |
33 | + LicenseTypeId:number=0; | |
33 | 34 | RemoveColumns: Array<string> = ["Serial_No", "LicenseId","RowNum"] |
34 | 35 | error; |
35 | 36 | public href: string = ""; |
... | ... | @@ -58,7 +59,11 @@ export class GlobalService { |
58 | 59 | this.aiaPingInterval=this.loggedInUser.aiaPingInterval; |
59 | 60 | this.SessionId=this.loggedInUser.SessionId; |
60 | 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