diff --git a/src/app/components/familiy-dash/familiy-dash.component.ts b/src/app/components/familiy-dash/familiy-dash.component.ts index 172d618..24f3ef5 100644 --- a/src/app/components/familiy-dash/familiy-dash.component.ts +++ b/src/app/components/familiy-dash/familiy-dash.component.ts @@ -121,6 +121,9 @@ export class FamiliyDashComponent implements OnInit { case "acc-family/activities": pageToNavigate = "family"; break; + case "acc-family/activities?tab=waiting": + pageToNavigate = "family"; + break; } if (pageToNavigate != "") { this.router.navigate([pageToNavigate], { state: item }); diff --git a/src/app/components/jobowner-dash/jobowner-dash.component.ts b/src/app/components/jobowner-dash/jobowner-dash.component.ts index cf3e809..ab59761 100644 --- a/src/app/components/jobowner-dash/jobowner-dash.component.ts +++ b/src/app/components/jobowner-dash/jobowner-dash.component.ts @@ -60,6 +60,9 @@ export class JobownerDashComponent implements OnInit { case "acc-family/activities": pageToNavigate = "family"; break; + case "acc-family/activities?tab=waiting": + pageToNavigate = "family"; + break; } if(pageToNavigate !=''){ diff --git a/src/app/components/offers-received/offers-received.component.ts b/src/app/components/offers-received/offers-received.component.ts index 43b30a3..4032627 100644 --- a/src/app/components/offers-received/offers-received.component.ts +++ b/src/app/components/offers-received/offers-received.component.ts @@ -30,6 +30,12 @@ export class OffersReceivedComponent implements OnInit { public bannersDataService: BannersDataService ) { + + addEventListener('app-banner-ready', (data:any) => { + console.log("BANNER DATA ", data); + this.reduceOfferData(); + }); + this.session_image_server = this.sessionDataProviderService.session_image_server; setInterval(()=>{ this.reduceOfferData(); // = this.bannersDataService.offerData; @@ -140,7 +146,7 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){ reduceOfferData(){ this.offerData = this.bannersDataService.offerData; - if( this.offerData.length >1 && this.noLimit == false){ + if( this.offerData?.length >1 && this.noLimit == false){ this.offerDataReduced = this.offerData.slice(0,2); } else{ diff --git a/src/app/components/workers-dash/workers-dash.component.ts b/src/app/components/workers-dash/workers-dash.component.ts index 64db4e5..38650e7 100644 --- a/src/app/components/workers-dash/workers-dash.component.ts +++ b/src/app/components/workers-dash/workers-dash.component.ts @@ -148,6 +148,10 @@ export class WorkersDashComponent implements OnInit { pageToNavigate = "family"; break; + case "acc-family/activities?tab=waiting": + pageToNavigate = "family"; + break; + } if(pageToNavigate !=''){ this.router.navigate([pageToNavigate],{state: item}); diff --git a/src/app/pages/home/home.page.ts b/src/app/pages/home/home.page.ts index ad5726a..130d8fd 100644 --- a/src/app/pages/home/home.page.ts +++ b/src/app/pages/home/home.page.ts @@ -54,6 +54,12 @@ export class HomePage implements OnInit { this.active_job_count = this.sessionDataProviderService.active_job_count; this.enableTracking = this.sessionDataProviderService.tracking; this.etag = "" + Date.now(); + + addEventListener('app-banner-ready', (data:any) => { + console.log("BANNER DATA ", data); + this.refreshBannersData(); + }); + addEventListener("dash_tool_myjobs", () => { this.myJobs(1); }); @@ -257,6 +263,9 @@ export class HomePage implements OnInit { case "acc-family/activities": pageToNavigate = "family"; break; + case "acc-family/activities?tab=waiting": + pageToNavigate = "family"; + break; } if (pageToNavigate != "") { this.router.navigate([pageToNavigate], { state: item }); diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 6178657..3829d4d 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -135,10 +135,10 @@ getBlogData(){ this.isDisabled=true; if (this.username == null || this.username == '' || this.validateEmail(this.username) == false || this.password == null || this.password == '') { - this.showAlert('Invalid Login', 'Enter username(email) and password to login'); + await this.showAlert('Invalid Login', 'Enter username(email) and password to login'); return; } - loading.present(); + await loading.present(); this.loginData = { username: this.username, password: this.password, sessionid: 'DUMMY-APP-SESSION' } this.wrenchService.loginUser(this.loginData).subscribe( loginResult => { @@ -181,6 +181,7 @@ getBlogData(){ } async startUpCalls(){ + await this.bannersDataService.clearCurrentBanners(); await this.bannersDataService.getBannersData(); await this.joinLoginSockets(); await this.intervalRefreshService.startIntervalCalls(); // anything with interval call @@ -236,7 +237,7 @@ getBlogData(){ } else{ this. onReturnToLogin(); - this.showAlert("Sign up error","Unable to complete the sign up, please try again"); + this.showAlert("Sign up error","Unable to complete the sign up, please try again"); } } diff --git a/src/app/store/banners-data.service.ts b/src/app/store/banners-data.service.ts index 2e2a0fa..64a84ab 100644 --- a/src/app/store/banners-data.service.ts +++ b/src/app/store/banners-data.service.ts @@ -27,6 +27,9 @@ export class BannersDataService { offset: 0; }; + async clearCurrentBanners(){ + this.bannerResult = []; // we need empty + } async getBannersData(){ if (this.sessionDataProviderService.account_type=='FAMILY'){ await this.getFamilyBannersData(); @@ -67,11 +70,16 @@ export class BannersDataService { this.bannerData = this.bannerResult.result_list; this.offerData = this.bannerResult.offers_list; if (this.bannerResult?.home_dash_type != "") { - // debugger; - this.sessionDataProviderService.home_dash_type = - this.bannerResult.home_dash_type; + this.sessionDataProviderService.home_dash_type = this.bannerResult.home_dash_type; + // YOU NEED EVENT FOR EVERYBODY TO REFRESH IF SUBSCRIBED + } this.homebannerCount = this.bannerData?.length; + // YOU NEED EVENT FOR EVERYBODY TO REFRESH IF SUBSCRIBED + const event = new CustomEvent("app-banner-ready", {detail: { + banners: this.bannerData, + offers: this.offerData + }}); }); }