wallet servcie

This commit is contained in:
CHIEFSOFT\ameye
2023-10-14 11:39:45 -04:00
parent f1ad1f3cbf
commit 63d18407e1
7 changed files with 153 additions and 24 deletions
+22 -1
View File
@@ -39,4 +39,25 @@ ionic generate page startscan
ionic generate page suggest
ionic generate page suggestdetails
ionic generate page playground
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
+31 -15
View File
@@ -90,6 +90,22 @@
</div>
<ng-template #elseFulltag>
<ion-toolbar class="top-tool" *ngIf="walletDescription !='' || active_job_count != 0">
<ion-buttons slot="secondary" *ngIf="walletDescription !='' ">
<ion-button fill="solid" (click)="myWallet()">
<ion-icon slot="end" name="wallet"></ion-icon>
Wallet
</ion-button>
</ion-buttons>
<ion-buttons slot="primary" *ngIf="active_job_count != 0">
<ion-button fill="solid" (click)="myJobs(1)">
My Jobs
<ion-icon slot="end" name="list"></ion-icon>
</ion-button>
</ion-buttons>
<ion-title>{{walletDescription}}</ion-title>
</ion-toolbar>
<div *ngIf = "homebannerCount <3;">
<div class="offer">
<div class="bg_image back_image" [style.backgroundImage]="'url('+offerBanner+')'"></div>
@@ -176,21 +192,21 @@
<!-- <div class="bg_image back_image" [style.backgroundImage]="'url(assets/images/taskbanners/'+item.banner+')'"></div>-->
<div *ngIf="active_job_count != 0">
<ion-fab slot="fixed" class="job_fab" vertical="top" color="primary" horizontal="end" [edge]="true">
<ion-fab-button>
<ion-label>My Jobs</ion-label>
</ion-fab-button>
<ion-fab-list side="bottom">
<ion-fab-button color="secondary" (click)="myJobs(1)">
<ion-icon name="list"></ion-icon>
</ion-fab-button>
<ion-fab-button color="success" (click)="myJobs(2)">
<ion-icon name="list"></ion-icon>
</ion-fab-button>
<ion-fab-button color="danger" (click)="myJobs(3)">
</ion-fab-button>
</ion-fab-list>
</ion-fab>
<!-- <ion-fab slot="fixed" class="job_fab" vertical="top" color="primary" horizontal="end" [edge]="true">-->
<!-- <ion-fab-button>-->
<!-- <ion-label>My Jobs</ion-label>-->
<!-- </ion-fab-button>-->
<!-- <ion-fab-list side="bottom">-->
<!-- <ion-fab-button color="secondary" (click)="myJobs(1)">-->
<!-- <ion-icon name="list"></ion-icon>-->
<!-- </ion-fab-button>-->
<!-- <ion-fab-button color="success" (click)="myJobs(2)">-->
<!-- <ion-icon name="list"></ion-icon>-->
<!-- </ion-fab-button>-->
<!-- <ion-fab-button color="danger" (click)="myJobs(3)">-->
<!-- </ion-fab-button>-->
<!-- </ion-fab-list>-->
<!-- </ion-fab>-->
</div>
+4
View File
@@ -38,6 +38,10 @@ ion-header {
}
}
}
.top-tool{
--background: #eba558;
border-radius: 10px;
}
.fam1{
margin:10px 0px 10px 0px;
border-radius: 10px;
+22 -6
View File
@@ -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){
+10 -2
View File
@@ -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']);
}
+16
View File
@@ -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();
});
});
+48
View File
@@ -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);
}
);
}
}