diff --git a/src/app/components/dash-toptool/dash-toptool.component.html b/src/app/components/dash-toptool/dash-toptool.component.html new file mode 100644 index 0000000..7ccadcc --- /dev/null +++ b/src/app/components/dash-toptool/dash-toptool.component.html @@ -0,0 +1,33 @@ + + + + + {{walletDescription}} + + + + Wallet + + + + + My Jobs + + + + + \ No newline at end of file diff --git a/src/app/components/dash-toptool/dash-toptool.component.scss b/src/app/components/dash-toptool/dash-toptool.component.scss new file mode 100644 index 0000000..29a32e9 --- /dev/null +++ b/src/app/components/dash-toptool/dash-toptool.component.scss @@ -0,0 +1,9 @@ +.top-tool{ + --background: #e9f1f1; + border-radius: 10px; + ion-buttons{ + ion-button{ + font-size: 12px; + } + } +} \ No newline at end of file diff --git a/src/app/components/dash-toptool/dash-toptool.component.spec.ts b/src/app/components/dash-toptool/dash-toptool.component.spec.ts new file mode 100644 index 0000000..ded587c --- /dev/null +++ b/src/app/components/dash-toptool/dash-toptool.component.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { DashToptoolComponent } from './dash-toptool.component'; + +describe('DashToptoolComponent', () => { + let component: DashToptoolComponent; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ DashToptoolComponent ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(DashToptoolComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/components/dash-toptool/dash-toptool.component.ts b/src/app/components/dash-toptool/dash-toptool.component.ts new file mode 100644 index 0000000..036c948 --- /dev/null +++ b/src/app/components/dash-toptool/dash-toptool.component.ts @@ -0,0 +1,47 @@ +import { Component, OnInit } from '@angular/core'; +import {SessionDataProviderService} from "../../store/session-data-provider.service"; +import {WrenchService} from "../../services/wrench.service"; +import {OnesignalService} from "../../services/onesignal.service"; +import {BlogDataService} from "../../store/blog-data.service"; +import {UserWalletService} from "../../store/user-wallet.service"; + +@Component({ + selector: 'app-dash-toptool', + templateUrl: './dash-toptool.component.html', + styleUrls: ['./dash-toptool.component.scss'], +}) +export class DashToptoolComponent implements OnInit { + walletDescription:string =""; + walletData:any; + active_job_count:number=0; + + constructor( public sessionDataProviderService: SessionDataProviderService, + private wrenchService: WrenchService, + private onesignalService: OnesignalService, + public blogDataService: BlogDataService, + public userWalletService: UserWalletService) { } + + ngOnInit() { + this.walletPresentation(); + this.active_job_count = this.sessionDataProviderService.active_job_count; + setInterval(()=>{ + this.walletPresentation(); + this.active_job_count = this.sessionDataProviderService.active_job_count; + }, 100000); + } + + 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; + } + } + myJobs(jmode){ + dispatchEvent(new Event("dash_tool_myjobs")); + } + myWallet(){ + dispatchEvent(new Event("dash_tool_mywallet")); + } +} diff --git a/src/app/pages/home/home.module.ts b/src/app/pages/home/home.module.ts index 7250204..a56b7d0 100644 --- a/src/app/pages/home/home.module.ts +++ b/src/app/pages/home/home.module.ts @@ -19,6 +19,7 @@ import { FamiliyNokidsComponent } from '../../components/familycards/familiy-nok import {FamiliyNotaskComponent} from "../../components/familycards/familiy-notask/familiy-notask.component"; import {FamiliyAddfamilyComponent} from "../../components/familycards/familiy-addfamily/familiy-addfamily.component"; import {FamiliyAllowanceComponent} from "../../components/familycards/familiy-allowance/familiy-allowance.component"; +import {DashToptoolComponent} from "../../components/dash-toptool/dash-toptool.component"; // @NgModule({ // schemas: [CUSTOM_ELEMENTS_SCHEMA] @@ -37,7 +38,8 @@ import {FamiliyAllowanceComponent} from "../../components/familycards/familiy-al LatestMarketComponent,HelpListingComponent, FamiliyDashComponent,FamiliyNokidsComponent, FamiliyNotaskComponent,FamiliyAddfamilyComponent, - FamiliyAllowanceComponent + FamiliyAllowanceComponent, + DashToptoolComponent ], schemas: [CUSTOM_ELEMENTS_SCHEMA] }) diff --git a/src/app/pages/home/home.page.html b/src/app/pages/home/home.page.html index 766ecb8..1d13bfc 100644 --- a/src/app/pages/home/home.page.html +++ b/src/app/pages/home/home.page.html @@ -16,7 +16,6 @@ -
@@ -38,7 +37,7 @@
- +
@@ -56,22 +55,25 @@
- - - - - {{walletDescription}} - - - - - My Jobs - - - - - - + + + + + + + + + + + + + + + + + + + @@ -87,11 +89,13 @@ +
-
-
-
+ + +
+
diff --git a/src/app/pages/home/home.page.ts b/src/app/pages/home/home.page.ts index b9acac2..e352d9c 100644 --- a/src/app/pages/home/home.page.ts +++ b/src/app/pages/home/home.page.ts @@ -49,6 +49,15 @@ export class HomePage implements OnInit { this.blogData = this.blogDataService.blogData; this.active_job_count = this.sessionDataProviderService.active_job_count; this.enableTracking = this.sessionDataProviderService.tracking; + + addEventListener('dash_tool_myjobs', () => { + this. myJobs(1); + }); + + addEventListener('dash_tool_mywallet', () => { + this.myWallet(); + }); + } allInitFunctions(){ @@ -69,7 +78,7 @@ export class HomePage implements OnInit { //debugger; - this.walletPresentation(); + // this.walletPresentation(); } ngOnInit() { this.allInitFunctions(); @@ -81,14 +90,14 @@ export class HomePage implements OnInit { 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; - } - } + // 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']); } @@ -104,7 +113,7 @@ export class HomePage implements OnInit { this.getFamilySuggestList(); } - this.walletPresentation(); + // this.walletPresentation(); //debugger; } blogResult:any; diff --git a/src/app/store/interval-refresh.service.ts b/src/app/store/interval-refresh.service.ts index 62b1a75..ff0f827 100644 --- a/src/app/store/interval-refresh.service.ts +++ b/src/app/store/interval-refresh.service.ts @@ -5,6 +5,7 @@ import {TasksDataService} from "./tasks-data.service"; import {BannersDataService} from "./banners-data.service"; import {UsersoffersDataService} from "./usersoffers-data.service"; import {FamilyDataService} from "./family-data.service"; +import {UserWalletService} from "./user-wallet.service"; @Injectable({ providedIn: 'root' @@ -16,7 +17,8 @@ export class IntervalRefreshService { public tasksDataService:TasksDataService, public bannersDataService:BannersDataService, public usersoffersDataService:UsersoffersDataService, - public familyDataService: FamilyDataService + public familyDataService: FamilyDataService, + public userWalletService: UserWalletService ) { this.marketDataService.getJobsData(); } @@ -33,6 +35,7 @@ export class IntervalRefreshService { this.marketDataService.getJobsData(); this.tasksDataService.getJobsData(); this.usersoffersDataService.getMyOffersData(); + this.userWalletService.getWalletData(); if ( this.sessionDataProviderService.account_type=='FAMILY'){ this.familyDataService.getFamilySuggestList(); diff --git a/src/app/store/user-wallet.service.ts b/src/app/store/user-wallet.service.ts index 9e41f8a..60feb0c 100644 --- a/src/app/store/user-wallet.service.ts +++ b/src/app/store/user-wallet.service.ts @@ -25,8 +25,7 @@ export class UserWalletService { } rawWallet:any; - getWallet(){ - // this.rawWallet = this.getWalletData(); + async getWallet(){ return this.walletData; }