From 7b4bdba9aaa832f3ea18fa473c56d370b8b013ae Mon Sep 17 00:00:00 2001 From: birendra.kumar Date: Tue, 15 Mar 2022 14:29:07 +0530 Subject: [PATCH] phone format and other issue fixed --- 400-SOURCECODE/AIAHTML5.ADMIN.API/Web.config | 4 ++-- 400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj | 2 +- 400-SOURCECODE/AIAHTML5.API/Web.config | 5 ++--- 400-SOURCECODE/Admin/src/app/app.component.ts | 23 ++++++++++++++++++++++- 400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.html | 3 ++- 400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.ts | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------- 400-SOURCECODE/Admin/src/app/components/LicenseEntity/editlicensebasicsettings.component.html | 11 ++++++----- 400-SOURCECODE/Admin/src/app/components/LicenseEntity/editlicensebasicsettings.component.ts | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------- 400-SOURCECODE/Admin/src/app/shared/global.ts | 7 ++++++- 400-SOURCECODE/Admin/src/assets/data/Menu.json | 1 + 10 files changed, 214 insertions(+), 113 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Web.config b/400-SOURCECODE/AIAHTML5.ADMIN.API/Web.config index 589c344..ca305b5 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Web.config +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Web.config @@ -64,8 +64,8 @@ - - + + diff --git a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj index 3b104ce..2a9cbf9 100644 --- a/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj +++ b/400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj @@ -178,7 +178,7 @@ - True + False True 63874 / diff --git a/400-SOURCECODE/AIAHTML5.API/Web.config b/400-SOURCECODE/AIAHTML5.API/Web.config index 752b3e8..15cbdb2 100644 --- a/400-SOURCECODE/AIAHTML5.API/Web.config +++ b/400-SOURCECODE/AIAHTML5.API/Web.config @@ -63,9 +63,8 @@ - - - + + diff --git a/400-SOURCECODE/Admin/src/app/app.component.ts b/400-SOURCECODE/Admin/src/app/app.component.ts index f132655..ddd925c 100644 --- a/400-SOURCECODE/Admin/src/app/app.component.ts +++ b/400-SOURCECODE/Admin/src/app/app.component.ts @@ -33,6 +33,8 @@ export class AppComponent implements OnInit { public submenustaus: string; public UpdateProfileVisible: boolean; public UserManageRightsList: Array; + + public LicenseTypeId:any; 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,) { const projectTitle= this.titleService.getTitle(); @@ -95,7 +97,26 @@ export class AppComponent implements OnInit { ngOnInit(): void { this.menustaus = "True"; this.global.getJSON().subscribe(data => { - this.obj = data["AdminSections"] + this.obj = data["AdminSections"] ; + this.LicenseTypeId=this.global.LicenseTypeId; + if(this.LicenseTypeId !=undefined && this.LicenseTypeId!=0 && this.global.UserTypeName=="Client Admin") + { + if(this.obj[2].UserType=="Client Admin") + { + var mainsection=this.obj[2]; + var clientadminSection=mainsection.HeaderMenu[4]; + var siteUageReportSection=clientadminSection.SubMenu[6]; + var concurrentLicenseId=siteUageReportSection.LicenseTypeId; + + //do not show this report for concurrent license of client admin + if(concurrentLicenseId ==this.LicenseTypeId) + { + siteUageReportSection.SubMenuStatus="False"; + } + } + } + + for (let i = 0; i < 7; i++) { if (this.obj[i].Id == this.global.UserType) { if (this.global.UserTypeName == "General Admin") { diff --git a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.html b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.html index 2924a11..12e29d6 100644 --- a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.html +++ b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.html @@ -242,6 +242,7 @@ {{item.StateName}} +
State is required
@@ -277,7 +278,7 @@
- (xxx-xxx-xxxx) + (xxx-xxx-xxxx)
Phone is required
Phone is invalid
diff --git a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.ts b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.ts index ecf20fc..4fe0258 100644 --- a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.ts +++ b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/addlicense.component.ts @@ -50,6 +50,7 @@ export class AddLicense implements OnInit { dateStartInvalid: boolean = false; dateEndInvalid: boolean = false; dateRenewInvalid: boolean = false; + IsUniteState:Boolean=false; NumberOfRows:number=0; constructor(private _loadingService: LoadingService,private licenseService: LicenseService, private globalService: GlobalService, private router: Router, private activeRoute: ActivatedRoute, @@ -76,11 +77,12 @@ export class AddLicense implements OnInit { address1: ['', [Validators.required,this.noWhitespaceValidator]], address2: [''], city: ['', [Validators.required,this.noWhitespaceValidator]], - stateId: [0, Validators.min(1)], + stateId: [0, [Validators.min(1)]], countryId: [0, Validators.min(1)], zip: ['', [Validators.required]], emailId: ['', [Validators.required]], - phone: ['', [Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]], + //phone: ['', [Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]], + phone: ['', [Validators.required]], editionLoginArr: this.fb.array([]), editionLogins: [''], totalLogins: [0], @@ -198,47 +200,86 @@ export class AddLicense implements OnInit { onKeyUp(event: any) { var mobno = event.target.value; - var newnum=mobno; - if(mobno!="" && event.key!="Backspace") + var countryName =$("#Country option:selected").text().trim(); + + if(mobno!="" && event.key!="Backspace") + { + if(countryName=="United States") + { + this.USFormatPhoneNumber(mobno); + } + else { - var tempArr = mobno.split('-'); - - if(tempArr.length==1) - { - var countdigit=tempArr[0].length; - newnum=tempArr[0]; - if(countdigit==3) - { - newnum=tempArr[0]+"-"; - } - else if(countdigit>3) - { - newnum=tempArr[0].substr(0,3)+"-"+tempArr[0].substr(3,1); - } - - } - else if(tempArr.length==2) - { - newnum=tempArr[0]+"-"+tempArr[1]; - var countdigit=tempArr[1].length; - if(countdigit==3) - { - newnum=tempArr[0]+"-"+tempArr[1]+"-"; - } - else if(countdigit>3) - { - newnum= tempArr[0]+"-"+tempArr[1].substr(0,3)+"-"+tempArr[1].substr(3,1); - } - } - else - { - newnum=tempArr[0]+"-"+tempArr[1]+"-"+tempArr[2]; - } - + this.OtherFormatPhoneNumber(mobno); + } } - this.insertUpdateLicenseFrm.controls['phone'].setValue(newnum); }; + +OtherFormatPhoneNumber(mobno:any) +{ + //var regex = /\d+/g; + //var matches = mobno.match(regex); //extract digit only + //var currentNum= matches==null?"" :matches.join(''); + this.insertUpdateLicenseFrm.controls['phone'].setValue(mobno); +} + +USFormatPhoneNumber(mobno:any) +{ + var newformat=""; + if(mobno!="" && mobno!=null) + { + var regex = /\d+/g; + var matches = mobno.match(regex); //extract digit only + var currentNum= matches==null?"" :matches.join(''); + + for(var ind=0;ind) { this.modalRef = this.modalService.show(template); } @@ -469,15 +510,9 @@ export class AddLicense implements OnInit { this.insertUpdateLicenseFrm.controls['isActive'].setValue('false'); } - // this.insertUpdateLicenseFrm.controls['phone'].clearValidators(); - // if (this.lstCountry.find(C => C.Id == this.license.CountryId).CountryName != "United States") { - // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required,this.noWhitespaceValidator]); - // } - // else { - // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$'),this.noWhitespaceValidator]); - // } - // this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity(); this.insertUpdateLicenseFrm.controls['phone'].setValue(this.license.Phone); + // validate first phone number + this.UpdatePhoneValidation(); if (this.license.EditionLogins == null) return; var TempArr = this.license.EditionLogins.split('|'); @@ -774,16 +809,12 @@ export class AddLicense implements OnInit { if (this.lstCountry.find(C => C.Id == this.license.CountryId).CountryName != "United States") { this.license.StateId = this.lstState.find(C => C.StateName == "Other").Id; this.insertUpdateLicenseFrm.controls['stateId'].setValue(this.license.StateId); - // this.insertUpdateLicenseFrm.controls['phone'].clearValidators(); - // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required,this.noWhitespaceValidator]); } else { this.license.StateId = 0; this.insertUpdateLicenseFrm.controls['stateId'].setValue(this.license.StateId); - // this.insertUpdateLicenseFrm.controls['phone'].clearValidators(); - // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$'),this.noWhitespaceValidator]); } - //this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity(); + this.UpdatePhoneValidation(); } OnStateChange(element: any) { @@ -791,16 +822,11 @@ export class AddLicense implements OnInit { if (this.lstState.find(C => C.Id == this.license.StateId).StateName != "Other") { this.license.CountryId = this.lstCountry.find(C => C.CountryName == "United States").Id; this.insertUpdateLicenseFrm.controls['countryId'].setValue(this.license.CountryId); - // this.insertUpdateLicenseFrm.controls['phone'].clearValidators(); - // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$'),this.noWhitespaceValidator]); } else { this.license.CountryId = 0; this.insertUpdateLicenseFrm.controls['countryId'].setValue(this.license.CountryId); - // this.insertUpdateLicenseFrm.controls['phone'].clearValidators(); - // this.insertUpdateLicenseFrm.controls['phone'].setValidators([Validators.required,this.noWhitespaceValidator]); - } - // this.insertUpdateLicenseFrm.controls['phone'].updateValueAndValidity(); + } } SubscriptionPriceBlur() { diff --git a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/editlicensebasicsettings.component.html b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/editlicensebasicsettings.component.html index a01d332..0d7d4dd 100644 --- a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/editlicensebasicsettings.component.html +++ b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/editlicensebasicsettings.component.html @@ -122,15 +122,16 @@ {{item.StateName}} +
State is required
- - @@ -138,12 +139,12 @@
- +
- (xxx-xxx-xxxx) + (xxx-xxx-xxxx)
Phone is required
-
Phone is invalid
+
Phone is invalid
diff --git a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/editlicensebasicsettings.component.ts b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/editlicensebasicsettings.component.ts index 14a140e..50ae43b 100644 --- a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/editlicensebasicsettings.component.ts +++ b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/editlicensebasicsettings.component.ts @@ -32,6 +32,7 @@ export class EditLicenseBasicSettings implements OnInit { MinusCharater: number; LicenseId:number=0; AccountNumber:string=''; + IsUniteState:Boolean=false; constructor(private _loadingService: LoadingService,private licenseService: LicenseService, public globalService: GlobalService, private router: Router, @@ -53,11 +54,12 @@ export class EditLicenseBasicSettings implements OnInit { address1: ['', [Validators.required,this.noWhitespaceValidator]], address2: [''], city: ['', [Validators.required,this.noWhitespaceValidator]], - stateId: [0], + stateId: [0, [Validators.min(1)]], countryId: [0], zip: ['', [Validators.required]], emailId: ['', [Validators.required]], - phone: ['', [Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]], + //phone: ['', [Validators.required, Validators.pattern('^([0-9]{3})-([0-9]{3})-([0-9]{4})$')]], + phone: ['', [Validators.required]] }); this.GetCountry(); this.GetState(); @@ -114,57 +116,100 @@ export class EditLicenseBasicSettings implements OnInit { return isValid ? null: { 'whitespace': true }; } + onKeyUp(event: any) { var mobno = event.target.value; - var newnum=mobno; - if(mobno!="" && event.key!="Backspace") + var countryName =$("#Country option:selected").text().trim(); + if(mobno!="" && event.key!="Backspace") + { + if(countryName=="United States") + { + this.USFormatPhoneNumber(mobno); + } + else { - var tempArr = mobno.split('-'); - - if(tempArr.length==1) - { - var countdigit=tempArr[0].length; - newnum=tempArr[0]; - if(countdigit==3) - { - newnum=tempArr[0]+"-"; - } - else if(countdigit>3) - { - newnum=tempArr[0].substr(0,3)+"-"+tempArr[0].substr(3,1); - } - - } - else if(tempArr.length==2) - { - newnum=tempArr[0]+"-"+tempArr[1]; - var countdigit=tempArr[1].length; - if(countdigit==3) - { - newnum=tempArr[0]+"-"+tempArr[1]+"-"; - } - else if(countdigit>3) - { - newnum= tempArr[0]+"-"+tempArr[1].substr(0,3)+"-"+tempArr[1].substr(3,1); - } - } - else - { - newnum=tempArr[0]+"-"+tempArr[1]+"-"+tempArr[2]; - } + this.OtherFormatPhoneNumber(mobno); + } +} + +}; - } - this.updateLicenseBasicSettingsFrm.controls['phone'].setValue(newnum); - +OtherFormatPhoneNumber(mobno:any) +{ + //var regex = /\d+/g; + //var matches = mobno.match(regex); //extract digit only + //var currentNum= matches==null?"" :matches.join(''); + this.updateLicenseBasicSettingsFrm.controls['phone'].setValue(mobno); +} + +USFormatPhoneNumber(mobno:any) +{ + var newformat=""; + if(mobno!="" && mobno!=null) + { + var regex = /\d+/g; + var matches = mobno.match(regex); //extract digit only + var currentNum= matches==null?"" :matches.join(''); + + for(var ind=0;ind) { this.modalRef = this.modalService.show(template); } GetCountry() { this.licenseService.GetCountry() - .subscribe(y => { this.lstCountry = y; }, error => this.error = error); + .subscribe(y => { + this.lstCountry = y; + }, error => this.error = error); } GetState() { @@ -207,6 +252,8 @@ export class EditLicenseBasicSettings implements OnInit { this.updateLicenseBasicSettingsFrm.controls['emailId'].setValue(this.license.EmailId); this.updateLicenseBasicSettingsFrm.controls['phone'].setValue(this.license.Phone); this._loadingService.HideLoading("global-loading"); + + this.UpdatePhoneValidation(); }, error => this.error = error); } diff --git a/400-SOURCECODE/Admin/src/app/shared/global.ts b/400-SOURCECODE/Admin/src/app/shared/global.ts index 822cd14..7642c4b 100644 --- a/400-SOURCECODE/Admin/src/app/shared/global.ts +++ b/400-SOURCECODE/Admin/src/app/shared/global.ts @@ -30,6 +30,7 @@ export class GlobalService { SessionId:number=0; isSiteUser:boolean=false; isAdmin:boolean=false; + LicenseTypeId:number=0; RemoveColumns: Array = ["Serial_No", "LicenseId","RowNum"] error; public href: string = ""; @@ -58,7 +59,11 @@ export class GlobalService { this.aiaPingInterval=this.loggedInUser.aiaPingInterval; this.SessionId=this.loggedInUser.SessionId; this.isSiteUser=this.loggedInUser.isSiteUser; - this.isAdmin=this.loggedInUser.LicenseId==0?true:false;; + this.isAdmin=this.loggedInUser.LicenseId==0?true:false; + + if (this.loggedInUser.LicenseInfo != null) { + this.LicenseTypeId=this.loggedInUser.LicenseInfo.LicenseTypeId; + } } diff --git a/400-SOURCECODE/Admin/src/assets/data/Menu.json b/400-SOURCECODE/Admin/src/assets/data/Menu.json index b05d23c..5584eda 100644 --- a/400-SOURCECODE/Admin/src/assets/data/Menu.json +++ b/400-SOURCECODE/Admin/src/assets/data/Menu.json @@ -578,6 +578,7 @@ "SubMenuId": "218", "SubMenuName": "Site License Usage Report", "SubMenuUrl": "sitelicenseusagereport", + "LicenseTypeId": 1, "SubMenuStatus": "True" }, { -- libgit2 0.21.4