diff --git a/REMEMBER.txt b/REMEMBER.txt index f1d9ec3..ae3f5d5 100644 --- a/REMEMBER.txt +++ b/REMEMBER.txt @@ -39,4 +39,25 @@ ionic generate page startscan ionic generate page suggest ionic generate page suggestdetails -ionic generate page playground \ No newline at end of file +ionic generate page playground + +ionic generate service user-wallet + + + + + + + + + + + + +$ ionic generate +$ ionic generate page +$ ionic generate page contact +$ ionic generate component contact/form +$ ionic generate component login-form --change-detection=OnPush +$ ionic generate directive ripple --skip-import +$ ionic generate service user-wallet \ No newline at end of file diff --git a/src/app/pages/home/home.page.html b/src/app/pages/home/home.page.html index 1abd1e3..1ba9ad4 100644 --- a/src/app/pages/home/home.page.html +++ b/src/app/pages/home/home.page.html @@ -90,6 +90,22 @@ + + + + + Wallet + + + + + My Jobs + + + + {{walletDescription}} + +
@@ -176,21 +192,21 @@
- - - My Jobs - - - - - - - - - - - - + + + + + + + + + + + + + + +
diff --git a/src/app/pages/home/home.page.scss b/src/app/pages/home/home.page.scss index 13be2c3..5b70512 100644 --- a/src/app/pages/home/home.page.scss +++ b/src/app/pages/home/home.page.scss @@ -38,6 +38,10 @@ ion-header { } } } +.top-tool{ + --background: #eba558; + border-radius: 10px; +} .fam1{ margin:10px 0px 10px 0px; border-radius: 10px; diff --git a/src/app/pages/home/home.page.ts b/src/app/pages/home/home.page.ts index f45edbd..86d104a 100644 --- a/src/app/pages/home/home.page.ts +++ b/src/app/pages/home/home.page.ts @@ -4,6 +4,7 @@ import { SessionDataProviderService } from 'src/app/store/session-data-provider. import { BlogDataService } from 'src/app/store/blog-data.service'; import { WrenchService } from 'src/app/services/wrench.service'; import { OnesignalService } from 'src/app/services/onesignal.service';// +import { UserWalletService } from 'src/app/store/user-wallet.service'; //import * as stream from "stream"; @Component({ @@ -19,16 +20,19 @@ export class HomePage implements OnInit { accountType:string=""; profilePicture = "https://www.wrenchboard.com/assets/images/profile.jpg"; offerBanner = "https://www.wrenchboard.com/assets/images/apps/offer.jpg"; + walletDescription:string =""; + walletData:any; + constructor( private router: Router, public sessionDataProviderService: SessionDataProviderService, private wrenchService: WrenchService, private onesignalService: OnesignalService, - public blogDataService: BlogDataService + public blogDataService: BlogDataService, + public userWalletService: UserWalletService ) { this.accountType = sessionDataProviderService.account_type; - this.firstname = this.sessionDataProviderService.firstname; this.blogData = this.blogDataService.blogData; this.active_job_count = this.sessionDataProviderService.active_job_count; @@ -38,23 +42,29 @@ export class HomePage implements OnInit { if ( this.sessionDataProviderService.member_uid != ''){ console.log("BLOG HOME 002->", this.blogDataService.blogData); // this.firstname = this.sessionDataProviderService.firstname; - this.onesignalService.Init(this.sessionDataProviderService.member_uid); - + this.onesignalService.Init(this.sessionDataProviderService.member_uid); if (this.accountType == 'FULL'){ this.getBlogData([]); this.getBannersData(); } - if (this.accountType == 'FAMILY'){ // no need moved to components this.getFamilySuggestList(); } - } +//debugger; this.profilePicture = this.sessionDataProviderService.profilePicture(); + this.walletPresentation(); + } + walletPresentation(){ + this.walletData = this.userWalletService.getWallet(); + if( this.walletData?.length > 0 ) { + this.walletDescription = this.walletData[0].amount*0.01 + ' ' + this.walletData[0].description; + } + } goPlayground(){ this.router.navigate(['playground']); } @@ -67,6 +77,9 @@ export class HomePage implements OnInit { if (this.accountType == 'FAMILY'){ this.getFamilySuggestList(); } + + this.walletPresentation(); + //debugger; } blogResult:any; bannerResult:any; @@ -178,6 +191,9 @@ export class HomePage implements OnInit { } } + myWallet(){ + this.router.navigate(['tabs/tab4']); + } fabitem : {card_type: string}; myJobs(num){ diff --git a/src/app/pages/logout/logout.page.ts b/src/app/pages/logout/logout.page.ts index dbb371a..2846b36 100644 --- a/src/app/pages/logout/logout.page.ts +++ b/src/app/pages/logout/logout.page.ts @@ -12,11 +12,19 @@ export class LogoutPage implements OnInit { constructor( private navctr: NavController, private router: Router - ) { } + ) { - ngOnInit() { } + ngOnInit() { + this.returnToLogin(this.router); + } +returnToLogin(router: Router){ + setTimeout(function(){ + // this.onBack(); + router.navigate(['login']); + }, 5000); +} onBack() { this.router.navigate(['login']); } diff --git a/src/app/store/user-wallet.service.spec.ts b/src/app/store/user-wallet.service.spec.ts new file mode 100644 index 0000000..4d1a350 --- /dev/null +++ b/src/app/store/user-wallet.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { UserWalletService } from './user-wallet.service'; + +describe('UserWalletService', () => { + let service: UserWalletService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(UserWalletService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/store/user-wallet.service.ts b/src/app/store/user-wallet.service.ts new file mode 100644 index 0000000..f1805fa --- /dev/null +++ b/src/app/store/user-wallet.service.ts @@ -0,0 +1,48 @@ +import { Injectable } from '@angular/core'; +import { WrenchService } from "../services/wrench.service"; +import { SessionDataProviderService} from "./session-data-provider.service"; + +@Injectable({ + providedIn: 'root' +}) +export class UserWalletService { + + mainWalletBalance:number = 0; + mainWalletCurrency:string = 'Naira'; + + constructor(public wrenchService: WrenchService, + public sessionDataProviderService: SessionDataProviderService + ) { + this.getWalletData(); + } + walletDescription:string=""; + walletPresentation(){ + if( this.walletData?.length > 0 ) { + //this.walletDescription = this.walletData[0].amount*0.01 + ' ' + this.walletData[0].description; + } + } + + rawWallet:any; + getWallet(){ + // this.rawWallet = this.getWalletData(); + return this.walletData; + } + + walletResult:any; + walletData: []; + usrData: { + action:number, member_id: number, uid: string, sessionid: string, limit:20, page:1 + }; + getWalletData(){ + this.usrData = {action:11200, member_id: this.sessionDataProviderService.member_id, uid: this.sessionDataProviderService.member_uid, sessionid: this.sessionDataProviderService.session, limit:20, page:1 } + this.wrenchService.getUserWallets(this.usrData).subscribe( + walletResult => { + this.walletResult = walletResult; + console.log("WALLET RETURN->", this.walletResult); + this.walletData = this.walletResult.result_list; + // debugger; + console.log("WALLET RETURN DATA->", this.walletData); + } + ); + } +}