diff --git a/src/app/pages/addfamilykid/addfamilykid.page.ts b/src/app/pages/addfamilykid/addfamilykid.page.ts index 8ca6c36..b792fd4 100644 --- a/src/app/pages/addfamilykid/addfamilykid.page.ts +++ b/src/app/pages/addfamilykid/addfamilykid.page.ts @@ -2,6 +2,7 @@ import {Component, OnInit, ViewChild} from '@angular/core'; import {SessionDataProviderService} from "../../store/session-data-provider.service"; import {WrenchService} from "../../services/wrench.service"; import {LoadingController, NavController} from "@ionic/angular"; +import {Router} from "@angular/router"; @Component({ selector: 'app-addfamilykid', @@ -12,6 +13,9 @@ export class AddfamilykidPage implements OnInit { @ViewChild('firstname') firstname; @ViewChild('lastname') lastname; + + + @ViewChild('month') month; @ViewChild('year') year; addFamilyResult:string=''; @@ -20,6 +24,7 @@ export class AddfamilykidPage implements OnInit { constructor( private navctr: NavController, public sessionDataProviderService: SessionDataProviderService, + private router: Router, private wrenchService: WrenchService, private loadingCtrl: LoadingController ) { } @@ -32,7 +37,10 @@ export class AddfamilykidPage implements OnInit { //debugger; } - onBack() { + onBack() { + const pageToNavigate = "home"; + //dispatchEvent(new Event("force_profile_refresh")); + // this.router.navigate([pageToNavigate],); this.navctr.back(); } @@ -93,7 +101,7 @@ export class AddfamilykidPage implements OnInit { if (this.createFamilyResult.internal_return> 0){ this.firstname=''; this.lastname=''; - + dispatchEvent(new Event("force_profile_refresh")); this.createFamilyResult = "Family Added"; setTimeout(()=>{ this.createFamilyResult=""; diff --git a/src/app/pages/edit-profile/edit-profile.page.html b/src/app/pages/edit-profile/edit-profile.page.html index 95bf09e..aba6064 100644 --- a/src/app/pages/edit-profile/edit-profile.page.html +++ b/src/app/pages/edit-profile/edit-profile.page.html @@ -33,23 +33,35 @@ - + - + - + + + + + + + + + +
{{profileMessage}} - Update + Update
diff --git a/src/app/pages/edit-profile/edit-profile.page.scss b/src/app/pages/edit-profile/edit-profile.page.scss index ac5004a..f6e00ca 100644 --- a/src/app/pages/edit-profile/edit-profile.page.scss +++ b/src/app/pages/edit-profile/edit-profile.page.scss @@ -16,6 +16,7 @@ ion-header { ion-content { ion-card{ margin: 0px; + background-image: linear-gradient(to right, aliceblue, #f1f3f5,#fcfdfd,white,#fcfdfd,#f1f3f5,aliceblue); } .profile { display: flex; diff --git a/src/app/pages/edit-profile/edit-profile.page.ts b/src/app/pages/edit-profile/edit-profile.page.ts index 16e41b4..3a7ce61 100644 --- a/src/app/pages/edit-profile/edit-profile.page.ts +++ b/src/app/pages/edit-profile/edit-profile.page.ts @@ -34,24 +34,39 @@ export class EditProfilePage implements OnInit { email:string=''; online_name:string=''; profilePicture:string=''; - + city:string=''; + state:string=''; + user_state:string=''; ngOnInit() { this.firstname = this.sessionDataProviderService.firstname; this.lastname = this.sessionDataProviderService.lastname; + this.city = this.sessionDataProviderService.city; + this.state = this.sessionDataProviderService.user_state; + this.online_name = this.sessionDataProviderService.online_name; + + this.email = this.sessionDataProviderService.email; this.online_name = this.sessionDataProviderService.online_name; this.etag = '' + Date.now(); this.profilePicture = this.sessionDataProviderService.profilePicture(this.sessionDataProviderService.session, this.sessionDataProviderService.member_uid)+'?'+this.etag; setInterval(()=>{ - - var myIframe=document.getElementById('profile_pic'); - myIframe.style.backgroundImage=myIframe.style.backgroundImage; - - //document.getElementById("profile_pic").style.background="'url('"+this.profilePicture+"')'"; ///this.profilePicture; + // this.onBack(); }, 5000); - // document.getElementById("profile_pic").reload(true); } + + isDisabled:boolean= true; + verifyP(){ + this.isDisabled= true; + if ( this.firstname.length> 1 + && this.lastname.length> 1 + && this.city.length> 3 && this.state.length> 1 + ){ + this.isDisabled= false; + } + } + + ionViewWillEnter() { this.etag = '' + Date.now(); } @@ -105,8 +120,8 @@ export class EditProfilePage implements OnInit { firstname: this.firstname, lastname: this.lastname, email: this.email, - state: this.sessionDataProviderService.user_state, - city: this.sessionDataProviderService.city, + state: this.state, + city: this.city, online_name: this.online_name, pref_email: this.sessionDataProviderService.pref_email, pref_phone: this.sessionDataProviderService.pref_phone, @@ -121,6 +136,7 @@ export class EditProfilePage implements OnInit { if (this.profileResult?.internal_return==0){ this.profileMessage="Profile Updated"; dispatchEvent(new Event("profile_picture_updated")); + dispatchEvent(new Event("force_profile_refresh")); setTimeout(()=>{ this.etag = '' + Date.now(); this.profileMessage=''; diff --git a/src/app/pages/home/home.page.ts b/src/app/pages/home/home.page.ts index 1d4fcdb..a033e1b 100644 --- a/src/app/pages/home/home.page.ts +++ b/src/app/pages/home/home.page.ts @@ -59,10 +59,35 @@ export class HomePage implements OnInit { addEventListener('dash_tool_mywallet', () => { this.myWallet(); }); + + addEventListener('force_profile_refresh', () => { + this.forceProfileRefresh(); + }); + this.home_dash_type = this.sessionDataProviderService.home_dash_type; //this.home_dash_type = 'FAMILY_PARENT_DASH'; } + async forceProfileRefresh(){ + + this.usrData = { + action:15030, + member_id: this.sessionDataProviderService.member_id, + uid: this.sessionDataProviderService.member_uid, + sessionid: this.sessionDataProviderService.session, + 'limit': 30, + 'offset': 0 + }; + this.wrenchService.getProfile(this.usrData).subscribe( + profileResult => { + console.log("profileResult RETURN DATA->", profileResult ); + if( profileResult != null){ + this.sessionDataProviderService.RefreshGlobalSessionData(profileResult); + } + } + ); + + } allInitFunctions(){ if ( this.sessionDataProviderService.member_uid != ''){ this.onesignalService.Init(this.sessionDataProviderService.member_uid); @@ -75,59 +100,38 @@ export class HomePage implements OnInit { // no need moved to components this.getFamilySuggestList(); } } - -//debugger; - - - // this.walletPresentation(); } ngOnInit() { this.allInitFunctions(); - - } setProfilePicture(){ this.accountType = this.sessionDataProviderService.account_type; this.etag = '' + Date.now(); if (this.accountType == 'FULL'){ - // this.profilePicture = this.sessionDataProviderService.profilePicture(this.sessionDataProviderService.session, this.sessionDataProviderService.member_uid); this.profilePicture = this.sessionDataProviderService.profilePicture(this.sessionDataProviderService.session, this.sessionDataProviderService.member_uid)+'?'+this.etag; - /// debugger; } - if (this.accountType == 'FAMILY'){ this.profilePicture = this.sessionDataProviderService.profilePicture(this.sessionDataProviderService.session, this.sessionDataProviderService.family_uid)+'?'+this.etag; } } ionViewWillEnter(){ - console.log('Home page did enter - > ionViewWillEnter'); this.allInitFunctions(); } - // async walletPresentation(){ - // this.walletData = this.userWalletService.getWallet(); - // if( this.walletData?.length > 0 ) { - // var num = new Number(this.walletData[0].amount*0.01); - // //this.fee_display = num.toFixed(2); //outputs 14 - // this.walletDescription = num.toFixed(2) + ' ' + this.walletData[0].description; - // } - // } + goPlayground(){ this.router.navigate(['playground']); } ionViewDidEnter(){ if (this.accountType == 'FULL'){ - // this.profilePicture = this.sessionDataProviderService.profilePicture(this.sessionDataProviderService.session, this.sessionDataProviderService.member_uid); this.getBlogData([]); this.getBannersData(); } - if (this.accountType == 'FAMILY'){ - // this.profilePicture = this.sessionDataProviderService.profilePicture(this.sessionDataProviderService.session, this.sessionDataProviderService.family_uid); this.getFamilySuggestList(); } - this. setProfilePicture(); } + blogResult:any; bannerResult:any; bannerData: []; @@ -143,12 +147,6 @@ export class HomePage implements OnInit { ); } - // 'member_id' => int 1 - // 'sessionid' => string '6AD58B08A9F458E6E6819DD603E202C657DB9BFFDD956C16386CC65975CE0D53' (length=64) - // 'uid' => string '3119b744-42ad-4834-bb83-b737588754ca' (length=36) - // 'action' => int 11200 - // - async refreshBannersData(){ this.bannerData = this.bannersDataService.bannerData; this.homebannerCount = this.bannersDataService.homebannerCount; @@ -166,22 +164,6 @@ export class HomePage implements OnInit { var interval = setInterval( ()=> { this.refreshBannersData(); }, 5000); - - - // this.usrData = {action:11200, member_id: this.sessionDataProviderService.member_id, uid: this.sessionDataProviderService.member_uid, - // sessionid: this.sessionDataProviderService.session,'limit': 30, - // 'offset': 0 } - // this.wrenchService.getHomeBanners(this.usrData).subscribe( - // bannerResult => { - // this.bannerResult = bannerResult; - // console.log("BANNERS RETURN->", this.bannerResult); - // this.bannerData = this.bannerResult.result_list; - // this.homebannerCount = this.bannerData.length; - // // debugger; - // console.log("BANNERS RETURN DATA->", this.bannerData); - // // this.blogDataService.setBlogData(this.blogResult.blog_data); - // } - // ); } familySuggestResult:any; diff --git a/src/app/services/wrench.service.ts b/src/app/services/wrench.service.ts index a55156d..2b1aff4 100644 --- a/src/app/services/wrench.service.ts +++ b/src/app/services/wrench.service.ts @@ -283,6 +283,10 @@ export class WrenchService { return this.getPostData("updateprofile", profileData); } + getProfile(profileData) { + return this.getPostData("loadprofile", profileData); + } + offferResponse(respData){ return this.getPostData("offersresponse", respData); } diff --git a/src/app/store/session-data-provider.service.ts b/src/app/store/session-data-provider.service.ts index e7f0527..3ea44ee 100644 --- a/src/app/store/session-data-provider.service.ts +++ b/src/app/store/session-data-provider.service.ts @@ -130,6 +130,38 @@ export class SessionDataProviderService { return arrY; } + RefreshGlobalSessionData(loginResult: any){ + this.account_type = loginResult.account_type; + this.firstname = loginResult.firstname; + this.lastname = loginResult.lastname; + this.session = loginResult.session; + this.session_contructed=loginResult.balance; + this.email = loginResult.email; + this.username=loginResult.username; + this.last_login = loginResult.last_login2; + // this.profile_pic=loginResult.profile_pic; + // this.profile_pic_url = loginResult.profile_pic_url; + // this.isPedningJob = loginResult.pedningjob; + // this.isOfferJob = loginResult.offerjob; + this.user_state=loginResult.state; + // this.city = loginResult.city; + // this.online_name = loginResult.online_name; + // this.pref_email= loginResult.pref_email; + // this.pref_phone = loginResult.pref_phone; + // this.promo=loginResult.promo; + // this.active_job_count = loginResult.active_job_count; + // this.tracking = loginResult.tracking; + // this.session_image_server = loginResult.session_image_server; + // this.refresh = loginResult.refresh; + // this.family_types= loginResult.family_types; + // this.history_types =loginResult.history_types; + this.home_dash_type = (loginResult.home_dash_type != null)? loginResult.home_dash_type : 'DEFAULT_HOME_DASH'; + this.family_action =loginResult.family_action; + + + } + + ConstructGlobalSessionData(loginResult: any) { console.log('Hello ConstructGlobalSessionData Provider'); this.session_contructed=false;