This commit is contained in:
CHIEFSOFT\ameye
2024-02-13 12:48:47 -05:00
parent 327b038971
commit 23197ea805
10 changed files with 326 additions and 196 deletions
+1
View File
@@ -24,6 +24,7 @@ ionic generate component suggestedlist
ionic generate page addjob
ionic generate page familyaddtask
ionic generate component historyCompletedJobs
+5
View File
@@ -278,6 +278,11 @@ const routes: Routes = [
path: 'addfamilykid',
loadChildren: () => import('./pages/addfamilykid/addfamilykid.module').then(m => m.AddfamilykidPageModule)
},
{
path: 'familyaddtask',
loadChildren: () => import('./pages/familyaddtask/familyaddtask.module').then(m => m.FamilyaddtaskPageModule)
},
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { FamilyaddtaskPage } from './familyaddtask.page';
const routes: Routes = [
{
path: '',
component: FamilyaddtaskPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class FamilyaddtaskPageRoutingModule {}
@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { FamilyaddtaskPageRoutingModule } from './familyaddtask-routing.module';
import { FamilyaddtaskPage } from './familyaddtask.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
FamilyaddtaskPageRoutingModule
],
declarations: [FamilyaddtaskPage]
})
export class FamilyaddtaskPageModule {}
@@ -0,0 +1,19 @@
<ion-header mode="ios" class="ion-no-border">
<ion-toolbar>
<ion-buttons slot="start" (click)="onBack()">
<ion-button>
<ion-icon name="arrow-back-outline"></ion-icon>
</ion-button>
</ion-buttons>
<ion-buttons slot="end">
<!-- <ion-button>-->
<!-- <ion-icon name="ellipsis-horizontal-circle-outline"></ion-icon>-->
<!-- </ion-button>-->
</ion-buttons>
<ion-title>Add Task</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
</ion-content>
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { FamilyaddtaskPage } from './familyaddtask.page';
describe('FamilyaddtaskPage', () => {
let component: FamilyaddtaskPage;
let fixture: ComponentFixture<FamilyaddtaskPage>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ FamilyaddtaskPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(FamilyaddtaskPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,26 @@
import { Component, OnInit } from '@angular/core';
import {LoadingController, NavController} from "@ionic/angular";
import {Router} from "@angular/router";
import {SessionDataProviderService} from "../../store/session-data-provider.service";
import {WrenchService} from "../../services/wrench.service";
@Component({
selector: 'app-familyaddtask',
templateUrl: './familyaddtask.page.html',
styleUrls: ['./familyaddtask.page.scss'],
})
export class FamilyaddtaskPage implements OnInit {
constructor( private navctr: NavController,
private router: Router,
public sessionDataProviderService: SessionDataProviderService,
private wrenchService: WrenchService,
private loadingCtrl: LoadingController,) { }
ngOnInit() {
}
onBack() {
this.navctr.back();
}
}
@@ -75,6 +75,7 @@
<ion-label class="color"></ion-label>
<ion-button
(click)="addFamilyMemeberTask()"
shape="round">Add Task</ion-button>
</div>
+213 -196
View File
@@ -1,181 +1,194 @@
import {Component, OnInit, ViewChild} from '@angular/core';
import {LoadingController, NavController} from "@ionic/angular";
import {Router} from "@angular/router";
import {SessionDataProviderService} from "../../store/session-data-provider.service";
import {WrenchService} from "../../services/wrench.service";
import {Camera, CameraResultType, CameraSource} from "@capacitor/camera";
import {UserWalletService} from "../../store/user-wallet.service";
import { Component, OnInit, ViewChild } from "@angular/core";
import { LoadingController, NavController } from "@ionic/angular";
import { Router } from "@angular/router";
import { SessionDataProviderService } from "../../store/session-data-provider.service";
import { WrenchService } from "../../services/wrench.service";
import { Camera, CameraResultType, CameraSource } from "@capacitor/camera";
import { UserWalletService } from "../../store/user-wallet.service";
@Component({
selector: 'app-familymember',
templateUrl: './familymember.page.html',
styleUrls: ['./familymember.page.scss'],
selector: "app-familymember",
templateUrl: "./familymember.page.html",
styleUrls: ["./familymember.page.scss"],
})
export class FamilymemberPage implements OnInit {
@ViewChild('amount') amount;
@ViewChild('description') description;
@ViewChild("amount") amount;
@ViewChild("description") description;
familyMemberData: any;
tabs = 'lesson';
member_firstname:string='';
member_lastname:string='';
tabs = "lesson";
member_firstname: string = "";
member_lastname: string = "";
member_username:string='';
member_pin:string='';
family_uid:string='';
jobManagerActiveData:any;
session_image_server:string='';
curr_session:string='';
// family_member_uid:string='';
member_qr_string ='0000000';
etag:string='';
total_active:number = 0;
member_username: string = "";
member_pin: string = "";
family_uid: string = "";
jobManagerActiveData: any;
session_image_server: string = "";
curr_session: string = "";
// family_member_uid:string='';
member_qr_string = "0000000";
etag: string = "";
total_active: number = 0;
constructor(
private navctr: NavController,
private router: Router,
public sessionDataProviderService: SessionDataProviderService,
private wrenchService: WrenchService,
private loadingCtrl: LoadingController,
public userWalletService: UserWalletService
private navctr: NavController,
private router: Router,
public sessionDataProviderService: SessionDataProviderService,
private wrenchService: WrenchService,
private loadingCtrl: LoadingController,
public userWalletService: UserWalletService
) {
this.familyMemberData = this.router.getCurrentNavigation().extras.state;
this.familyMemberData = this.router.getCurrentNavigation().extras.state;
//debugger;
if ( this.familyMemberData != undefined && this.familyMemberData.itemData != undefined ){
this.member_firstname= this.familyMemberData.itemData.firstname;
this.member_lastname = this.familyMemberData.itemData.lastname;
this.family_uid = this.familyMemberData.itemData.family_uid;
this.jobManagerActiveData = this.familyMemberData.jobManagerActiveData;
this.total_active = this.jobManagerActiveData.length;
}else{
this.onBack();
}
if (
this.familyMemberData != undefined &&
this.familyMemberData.itemData != undefined
) {
this.member_firstname = this.familyMemberData.itemData.firstname;
this.member_lastname = this.familyMemberData.itemData.lastname;
this.family_uid = this.familyMemberData.itemData.family_uid;
this.jobManagerActiveData = this.familyMemberData.jobManagerActiveData;
this.total_active = this.jobManagerActiveData.length;
} else {
this.onBack();
}
this.etag = '' + Date.now();
// this.userWalletService.getWalletData();
this.etag = "" + Date.now();
// this.userWalletService.getWalletData();
}
ngOnInit() {
// this.familyMemberWalletData = this.userWalletService.walletData;
// this.familyMemberWalletData = this.userWalletService.walletData;
this.session_image_server = this.sessionDataProviderService.session_image_server;
this.curr_session=this.sessionDataProviderService.session;
this.session_image_server =
this.sessionDataProviderService.session_image_server;
this.curr_session = this.sessionDataProviderService.session;
this.getThisFamilyAccount();
this.getFamilyWalletsData();
if (
this.familyMemberData != undefined
&& this.familyMemberData .startPage != undefined
&& this.familyMemberData.startPage !=''
){
if (this.familyMemberData.startPage == 'WALLET'){
this.familyMemberData != undefined &&
this.familyMemberData.startPage != undefined &&
this.familyMemberData.startPage != ""
) {
if (this.familyMemberData.startPage == "WALLET") {
this.startFamilyMemberReward();
}
if (this.familyMemberData.startPage == 'TASK'){
this.tabs = 'about';
if (this.familyMemberData.startPage == "TASK") {
this.tabs = "about";
}
}
}
ionViewWillEnter() {
this.etag = '' + Date.now();
this.etag = "" + Date.now();
}
onBack() {
this.navctr.back();
}
startFamilyMemberReward(){
startFamilyMemberReward() {
var wallet = this.familyMemberWalletData;
// if (wallet.length> 0){
// this.startAddfund(wallet[0])
// debugger;
// }
// debugger;
// debugger;
}
jobActive(item){
this.router.navigate(['jobactive'],{state: item});
jobActive(item) {
this.router.navigate(["jobactive"], { state: item });
}
onMentor() {
this.router.navigate(['mentor']);
this.router.navigate(["mentor"]);
}
onEnroll() {
this.router.navigate(['enroll']);
this.router.navigate(["enroll"]);
}
postData: {
action:number,
member_id: number,
uid: string,
sessionid: string,
family_uid:string
action: number;
member_id: number;
uid: string;
sessionid: string;
family_uid: string;
};
familyMemberResult:any;
familySuggestData:any;
getThisFamilyAccount(){
familyMemberResult: any;
familySuggestData: any;
getThisFamilyAccount() {
this.postData = {
action:22025,
action: 22025,
member_id: this.sessionDataProviderService.member_id,
uid: this.sessionDataProviderService.member_uid,
sessionid: this.sessionDataProviderService.session,
family_uid: this.family_uid
family_uid: this.family_uid,
};
this.wrenchService.familyManage(this.postData).subscribe(
familyMemberResult => {
this.familyMemberResult = familyMemberResult;
console.log("familyMemberResult RETURN->", this.familyMemberResult);
this.member_username = this.familyMemberResult.username;
this.member_pin = this.familyMemberResult.pin;
// this.member_qr_string = this.sessionDataProviderService.member_uid+"@"+this.member_username+"@"+this.member_pin; //member_uid@family_username@family_pin
this.member_qr_string = this.sessionDataProviderService.member_uid+"@"+this.member_username+"@"+this.family_uid; //member_uid@family_username@family_pin
console.log("this.member_qr_string ----> ",this.member_qr_string);
}
);
this.wrenchService
.familyManage(this.postData)
.subscribe((familyMemberResult) => {
this.familyMemberResult = familyMemberResult;
console.log("familyMemberResult RETURN->", this.familyMemberResult);
this.member_username = this.familyMemberResult.username;
this.member_pin = this.familyMemberResult.pin;
// this.member_qr_string = this.sessionDataProviderService.member_uid+"@"+this.member_username+"@"+this.member_pin; //member_uid@family_username@family_pin
this.member_qr_string =
this.sessionDataProviderService.member_uid +
"@" +
this.member_username +
"@" +
this.family_uid; //member_uid@family_username@family_pin
console.log("this.member_qr_string ----> ", this.member_qr_string);
});
}
familyMemberWalletTotalData:any;
familyMemberWalletTotalData: any;
familyMemberWalletData: [];
getFamilyWalletsData(){
getFamilyWalletsData() {
this.postData = {
action:22025,
action: 22025,
member_id: this.sessionDataProviderService.member_id,
uid: this.sessionDataProviderService.member_uid,
sessionid: this.sessionDataProviderService.session,
family_uid: this.family_uid
family_uid: this.family_uid,
};
this.wrenchService.getFamilyWallets(this.postData).subscribe(
familyMemberWalletTotalData => {
this.familyMemberWalletTotalData = familyMemberWalletTotalData;
console.log("familyMemberWalletTotalData RETURN->", this.familyMemberWalletTotalData);
this.familyMemberWalletData = this.familyMemberWalletTotalData.result_list;
// debugger;
console.log("FAMILY familyMemberWalletData DATA->", this.familyMemberWalletData);
//this.suggestion_total = this.familyMemberWalletData.length;
}
);
this.wrenchService
.getFamilyWallets(this.postData)
.subscribe((familyMemberWalletTotalData) => {
this.familyMemberWalletTotalData = familyMemberWalletTotalData;
console.log(
"familyMemberWalletTotalData RETURN->",
this.familyMemberWalletTotalData
);
this.familyMemberWalletData =
this.familyMemberWalletTotalData.result_list;
// debugger;
console.log(
"FAMILY familyMemberWalletData DATA->",
this.familyMemberWalletData
);
//this.suggestion_total = this.familyMemberWalletData.length;
});
}
toolBarShow:string="1";
toolBarShow: string = "1";
backToToolBar(){
backToToolBar() {
this.toolBarShow = "1";
this.startSendData=null;
this.startSendData = null;
}
reqStart: {
action:number,
member_id: number,
uid: string,
sessionid: string,
family_uid: string,
wallet_uid: string
action: number;
member_id: number;
uid: string;
sessionid: string;
family_uid: string;
wallet_uid: string;
};
startAddfund(item:any){
startAddfund(item: any) {
// need to start ths process
/*
this.usrData = {action:11200, member_id: this.sessionDataProviderService.member_id, uid: this.sessionDataProviderService.member_uid,
@@ -210,63 +223,61 @@ familyTransfer(reqData){
}
*/
this.reqStart = {
action:22013,
action: 22013,
member_id: this.sessionDataProviderService.member_id,
uid: this.sessionDataProviderService.member_uid,
sessionid: this.sessionDataProviderService.session,
family_uid: this.family_uid,
wallet_uid: item.wallet_uid
wallet_uid: item.wallet_uid,
};
// debugger;
this.wrenchService.familyStartTransfer(this.reqStart).subscribe(
startSendData => {
this.startSendData = startSendData;
console.log("startSendData RETURN->", this.startSendData);
this.origing_current_balance = this.startSendData.origing_current_balance;
this.send_cuurency = this.startSendData.currency;
this.toolBarShow = item.wallet_uid;
// if ( this.accountAddResult.internal_return != undefined && this.accountAddResult.internal_return > 0 ){
// this.presentToast("Recipient Accound Added",'middle');
// setTimeout(() => {
// this.onBack();
// }, 3000);
// }
}
);
// debugger;
this.wrenchService
.familyStartTransfer(this.reqStart)
.subscribe((startSendData) => {
this.startSendData = startSendData;
console.log("startSendData RETURN->", this.startSendData);
this.origing_current_balance =
this.startSendData.origing_current_balance;
this.send_cuurency = this.startSendData.currency;
this.toolBarShow = item.wallet_uid;
// if ( this.accountAddResult.internal_return != undefined && this.accountAddResult.internal_return > 0 ){
// this.presentToast("Recipient Accound Added",'middle');
// setTimeout(() => {
// this.onBack();
// }, 3000);
// }
});
}
startSendData:any;
origing_current_balance:number =0;
send_cuurency:string='';
startSendData: any;
origing_current_balance: number = 0;
send_cuurency: string = "";
reqSend: {
action:number,
member_id: number,
uid: string,
sessionid: string,
family_uid: string,
origing_wallet_uid: string,
wallet_uid: string,
currency: string,
amount: number,
description:string,
family_transfer_mode: number
action: number;
member_id: number;
uid: string;
sessionid: string;
family_uid: string;
origing_wallet_uid: string;
wallet_uid: string;
currency: string;
amount: number;
description: string;
family_transfer_mode: number;
};
sendResultData:any;
sendResultData: any;
async sendReward(item){
async sendReward(item) {
const loading = await this.loadingCtrl.create({
message: 'Sending...',
message: "Sending...",
duration: 5500,
});
this.reqSend = {
action:22014,
action: 22014,
member_id: this.sessionDataProviderService.member_id,
uid: this.sessionDataProviderService.member_uid,
sessionid: this.sessionDataProviderService.session,
@@ -274,87 +285,93 @@ familyTransfer(reqData){
origing_wallet_uid: this.startSendData.origing_wallet_uid,
wallet_uid: item.wallet_uid,
currency: this.startSendData.currency,
amount: this.amount*100,
amount: this.amount * 100,
description: this.description,
family_transfer_mode: 100
family_transfer_mode: 100,
};
await loading.present();
this.wrenchService.familyTransfer(this.reqSend).subscribe(
sendResultData => {
loading.dismiss();
this.sendResultData = sendResultData;
console.log("sendResultData RETURN->", this.sendResultData);
// if all is good
setTimeout(()=>{
this.toolBarShow = "1";
this.startSendData=null;
}, 3000);
}
);
this.wrenchService
.familyTransfer(this.reqSend)
.subscribe((sendResultData) => {
loading.dismiss();
this.sendResultData = sendResultData;
console.log("sendResultData RETURN->", this.sendResultData);
// if all is good
setTimeout(() => {
this.toolBarShow = "1";
this.startSendData = null;
}, 3000);
});
}
uploadData: {
action:number,
member_id: number,
uid: string,
family_uid: string,
sessionid: string,
msg_type:'FILE',
file_name: string,
file_size: number,
file_type: string,
file_data: string
action: number;
member_id: number;
uid: string;
family_uid: string;
sessionid: string;
msg_type: "FILE";
file_name: string;
file_size: number;
file_type: string;
file_data: string;
};
uploadResult:any;
async startCamera(cameraMode){
uploadResult: any;
async startCamera(cameraMode) {
const image = await Camera.getPhoto({
quality: 50,
width : 600,
height : 300,
width: 600,
height: 300,
allowEditing: false,
resultType: CameraResultType.Base64,
source: (cameraMode == 100 ) ? CameraSource.Camera : CameraSource.Prompt // Camera, Photos or Prompt!
source: cameraMode == 100 ? CameraSource.Camera : CameraSource.Prompt, // Camera, Photos or Prompt!
});
if (image) {
const loading = await this.loadingCtrl.create({
message: 'Uploading Profile Picture',
message: "Uploading Profile Picture",
duration: 5000,
});
var file_size = parseInt(String(image.base64String.toString().length / 1.3224954) ) ;
var file_size = parseInt(
String(image.base64String.toString().length / 1.3224954)
);
// this.saveImage(image)
//debugger;
//image.base64String
this.uploadData={
action:11305,
this.uploadData = {
action: 11305,
member_id: this.sessionDataProviderService.member_id,
uid: this.sessionDataProviderService.member_uid,
family_uid: this.family_uid,
sessionid: this.sessionDataProviderService.session ,
msg_type:'FILE',
sessionid: this.sessionDataProviderService.session,
msg_type: "FILE",
file_name: `family-banner.${image.format}`,
file_size: file_size ,
file_size: file_size,
file_type: `image/${image.format}`,
file_data: image.base64String
file_data: image.base64String,
};
//console.log(image);
loading.present();
this.wrenchService.uploadFile(this.uploadData).subscribe(
uploadResult => {
this.etag = '' + Date.now();
this.uploadResult = uploadResult;
console.log("this.wrenchService.uploadFile RETURN DATA->", this.uploadResult);
}
);
this.wrenchService
.uploadFile(this.uploadData)
.subscribe((uploadResult) => {
this.etag = "" + Date.now();
this.uploadResult = uploadResult;
console.log(
"this.wrenchService.uploadFile RETURN DATA->",
this.uploadResult
);
});
console.log( this.uploadData);
console.log(this.uploadData);
}
}
startWalletPlan(){}
startWalletPlan() {}
addFamilyMemeberTask() {
this.router.navigate(["familyaddtask"]);
}
}