diff --git a/src/app/components/offers-received/offers-received.component.ts b/src/app/components/offers-received/offers-received.component.ts index 4032627..4ed353b 100644 --- a/src/app/components/offers-received/offers-received.component.ts +++ b/src/app/components/offers-received/offers-received.component.ts @@ -4,7 +4,6 @@ import {Router} from "@angular/router"; import {SessionDataProviderService} from "../../store/session-data-provider.service"; import {WrenchService} from "../../services/wrench.service"; import { BannersDataService } from "../../store/banners-data.service"; -//import {input} from "@capacitor/assets/dist/colors"; @Component({ selector: 'app-offers-received', @@ -12,13 +11,10 @@ import { BannersDataService } from "../../store/banners-data.service"; styleUrls: ['./offers-received.component.scss'], }) export class OffersReceivedComponent implements OnInit { -//@ViewChild('offerData') offerData: []; - //@ViewChild('noLimit') noLimit: boolean; @Input('noLimit') noLimit:boolean; @Input('showCount') showCount: boolean; total_offers:number = 0; offerData: any; - //noLimit: boolean=false; offerDataReduced: any; constructor( private navctrl: NavController, @@ -30,18 +26,18 @@ export class OffersReceivedComponent implements OnInit { public bannersDataService: BannersDataService ) { - addEventListener('app-banner-ready', (data:any) => { console.log("BANNER DATA ", data); + // debugger; + console.log("BANNER REFRESH SEEN ********* OFFER RECIEVED"); this.reduceOfferData(); }); this.session_image_server = this.sessionDataProviderService.session_image_server; setInterval(()=>{ - this.reduceOfferData(); // = this.bannersDataService.offerData; - + this.reduceOfferData(); this.session_image_server = this.sessionDataProviderService.session_image_server; - }, 15000); + }, 35000); } ngOnInit() { @@ -50,46 +46,22 @@ export class OffersReceivedComponent implements OnInit { session_image_server:string=''; curr_session:string=''; - // + usrData: { action:number, member_id: number, uid: string, sessionid: string, limit:20, page:1, offset:number }; - // total_offers:number = 0; - // myOffersTotalData:any; - // myOffersData: []; - // getMyOffersData(){ - // this.usrData = {action:15010, - // member_id: this.sessionDataProviderService.member_id, - // uid: this.sessionDataProviderService.member_uid, - // sessionid: this.sessionDataProviderService.session , - // limit:20, page:1,offset: 0} - // - // this.curr_session = this.sessionDataProviderService.session; - // this.wrenchService.getMyOffers(this.usrData).subscribe( - // myOffersTotalData => { - // this.myOffersTotalData = myOffersTotalData; - // this.session_image_server = this.myOffersTotalData.session_image_server; - // console.log("myOffersTotalData RETURN->", this.myOffersTotalData); - // this.myOffersData = this.myOffersTotalData.result_list; - // console.log("myOffersData RETURN DATA->", this.myOffersData); - // this.total_offers = this.myOffersData?.length; - // } - // ); - // - // } -currOpenOffer:string=''; + + currOpenOffer:string=''; openOfferDetail(item){ -if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){ - this.currOpenOffer = '' -}else -{ - this.currOpenOffer = item.offer_uid; -} - - + if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){ + this.currOpenOffer = '' + }else + { + this.currOpenOffer = item.offer_uid; + } } async requestStart(item) { @@ -101,7 +73,6 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){ text: "Cancel", role: "cancel", handler: () => { - // this.getMyOffersData(); this.reduceOfferData(); // = this.bannersDataService.offerData; }, }, @@ -109,7 +80,6 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){ text: "Start Now", handler: () => { this.sendOfferResponse(item, 100); - // this.getMyOffersData(); this.reduceOfferData(); // = this.bannersDataService.offerData; }, }, @@ -127,7 +97,6 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){ text: "Cancel", role: "cancel", handler: () => { - //this.getMyOffersData(); this.reduceOfferData(); // = this.bannersDataService.offerData; }, }, @@ -135,7 +104,6 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){ text: "Reject", handler: () => { this.sendOfferResponse(item, 333); - //this.getMyOffersData(); this.reduceOfferData(); // = this.bannersDataService.offerData; }, }, @@ -166,7 +134,6 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){ }; offerRespData:any; - // offferResponse(respData) async sendOfferResponse(item, respType){ const loading = await this.loadingCtrl.create({ message: 'Processing', @@ -186,11 +153,8 @@ if ( this.currOpenOffer != '' && this.currOpenOffer == item.offer_uid){ offerRespData => { this.offerRespData = offerRespData; console.log("offerRespData RETURN->", this.offerRespData); - // this.getMyOffersData(); - // this.offerData = this.bannersDataService.offerData; this.reduceOfferData(); } ); } - } diff --git a/src/app/pages/home/home.page.html b/src/app/pages/home/home.page.html index 3b4f340..9d00455 100644 --- a/src/app/pages/home/home.page.html +++ b/src/app/pages/home/home.page.html @@ -79,7 +79,10 @@ - + +
diff --git a/src/app/pages/home/home.page.ts b/src/app/pages/home/home.page.ts index 130d8fd..3ede62d 100644 --- a/src/app/pages/home/home.page.ts +++ b/src/app/pages/home/home.page.ts @@ -55,9 +55,13 @@ export class HomePage implements OnInit { this.enableTracking = this.sessionDataProviderService.tracking; this.etag = "" + Date.now(); + console.log("BANNER REFRESH SEEN ********* BANNER LISNETER HOME "); addEventListener('app-banner-ready', (data:any) => { console.log("BANNER DATA ", data); - this.refreshBannersData(); + this.bannerData = data.detail.banners; + this.offerBanner = data.detail.offers; + console.log("BANNER REFRESH SEEN ********* OFFER HOME PAGE"); + this.refreshBannersData(); }); addEventListener("dash_tool_myjobs", () => { diff --git a/src/app/store/banners-data.service.ts b/src/app/store/banners-data.service.ts index 64a84ab..871ac7b 100644 --- a/src/app/store/banners-data.service.ts +++ b/src/app/store/banners-data.service.ts @@ -69,6 +69,7 @@ export class BannersDataService { console.log("BANNERS RETURN->", this.bannerResult); this.bannerData = this.bannerResult.result_list; this.offerData = this.bannerResult.offers_list; + // debugger; if (this.bannerResult?.home_dash_type != "") { this.sessionDataProviderService.home_dash_type = this.bannerResult.home_dash_type; // YOU NEED EVENT FOR EVERYBODY TO REFRESH IF SUBSCRIBED @@ -76,10 +77,12 @@ export class BannersDataService { } this.homebannerCount = this.bannerData?.length; // YOU NEED EVENT FOR EVERYBODY TO REFRESH IF SUBSCRIBED - const event = new CustomEvent("app-banner-ready", {detail: { + console.log("BANNER REFRESH FIRED ********* BANNER MODULE"); + const event_banner = new CustomEvent("app-banner-ready", {detail: { banners: this.bannerData, offers: this.offerData }}); + dispatchEvent(event_banner); }); }