wallet on assign task

This commit is contained in:
CHIEFSOFT\ameye
2024-02-15 06:01:38 -05:00
parent d183fd2f3b
commit cbd4649c5c
2 changed files with 24 additions and 8 deletions
@@ -93,7 +93,7 @@
<ion-grid>
<ion-row>
<ion-col>
Wallet :
Wallet : {{job_wallet_balance*0.01| number : '1.2-2'}} {{job_wallet_description}}
</ion-col>
</ion-row>
</ion-grid>
@@ -1,8 +1,13 @@
import { Component, Input, OnInit } from "@angular/core";
import {LoadingController, NavController, ToastController} from "@ionic/angular";
import {
LoadingController,
NavController,
ToastController,
} from "@ionic/angular";
import { Router } from "@angular/router";
import { SessionDataProviderService } from "../../store/session-data-provider.service";
import { WrenchService } from "../../services/wrench.service";
import { UserWalletService } from "../../store/user-wallet.service";
@Component({
selector: "app-familyaddtask",
@@ -28,6 +33,7 @@ export class FamilyaddtaskPage implements OnInit {
public sessionDataProviderService: SessionDataProviderService,
private wrenchService: WrenchService,
private loadingCtrl: LoadingController,
public userWalletService: UserWalletService,
public toastController: ToastController
) {
// debugger;
@@ -46,13 +52,15 @@ export class FamilyaddtaskPage implements OnInit {
this.onBack();
}
}
walletResult:any;
walletData: [];
ngOnInit() {
this.getJobManagerList();
this.session_image_server =
this.sessionDataProviderService.session_image_server;
this.sessionDataProviderService.session_image_server;
this.curr_session = this.sessionDataProviderService.session;
this.walletResult = this.userWalletService.walletResult.result_list;
//debugger;
}
onBack() {
this.navctr.back();
@@ -105,6 +113,8 @@ export class FamilyaddtaskPage implements OnInit {
selected_task: any;
jobData: any;
job_select_id: number = 0;
job_wallet_balance:number = 0;
job_wallet_description:string='';
jobSelected() {
//selected_task
console.log(this.selected_task);
@@ -120,6 +130,12 @@ export class FamilyaddtaskPage implements OnInit {
this.jobData = locJobData[0];
this.job_select_id = this.jobData.id;
console.log("this.jobData --- > ", this.jobData);
let currWallet = this.walletResult.filter((itm)=> itm.country == this.jobData.job_country );
if ( currWallet!= undefined && currWallet.length == 1){
this.job_wallet_balance = currWallet[0].amount;
this.job_wallet_description = currWallet[0].description;
}
// debugger;
}
}
@@ -188,18 +204,18 @@ export class FamilyaddtaskPage implements OnInit {
this.assigResult.offer_code != ""
) {
const event = new Event("app-myjob-offers-refresh");
this.presentToast("Task Sent",'middle');
this.presentToast("Task Sent", "middle");
dispatchEvent(event);
setTimeout(() => {
this.assign_ind_result = "";
this.onBack();
}, 3000);
} else {
this.presentToast("Error: Unable to send task ",'middle');
this.presentToast("Error: Unable to send task ", "middle");
}
});
}
async presentToast(amessage, position: 'top' | 'middle' | 'bottom') {
async presentToast(amessage, position: "top" | "middle" | "bottom") {
const toast = await this.toastController.create({
message: amessage,
duration: 2500,