diff --git a/src/app/components/familycards/familiy-notask/familiy-notask.component.html b/src/app/components/familycards/familiy-notask/familiy-notask.component.html index ddc4ba0..c114dcf 100644 --- a/src/app/components/familycards/familiy-notask/familiy-notask.component.html +++ b/src/app/components/familycards/familiy-notask/familiy-notask.component.html @@ -3,7 +3,7 @@ - Assign Task + Assign Task diff --git a/src/app/pages/family/family.page.ts b/src/app/pages/family/family.page.ts index 91135e2..d28f3b3 100644 --- a/src/app/pages/family/family.page.ts +++ b/src/app/pages/family/family.page.ts @@ -1,58 +1,70 @@ -import { Component, OnInit } from '@angular/core'; -import {NavController} from "@ionic/angular"; -import {Router} from "@angular/router"; -import { WrenchService } from 'src/app/services/wrench.service'; -import {SessionDataProviderService} from "../../store/session-data-provider.service"; -import {FamilysuggestPendingService} from "../../store/familysuggest-pending.service"; -import {UserWalletService} from "../../store/user-wallet.service"; - +import { Component, OnInit } from "@angular/core"; +import { NavController } from "@ionic/angular"; +import { Router } from "@angular/router"; +import { WrenchService } from "src/app/services/wrench.service"; +import { SessionDataProviderService } from "../../store/session-data-provider.service"; +import { FamilysuggestPendingService } from "../../store/familysuggest-pending.service"; +import { UserWalletService } from "../../store/user-wallet.service"; @Component({ - selector: 'app-family', - templateUrl: './family.page.html', - styleUrls: ['./family.page.scss'], + selector: "app-family", + templateUrl: "./family.page.html", + styleUrls: ["./family.page.scss"], }) export class FamilyPage implements OnInit { + tabs = "members"; + suggestion_total: number = 0; + total_family: number = 0; + family_active: number = 0; + session_image_server: string = ""; + curr_session: string = ""; + etag: string = ""; + currFamState: any; + family_action: string = "DEFAULT_FAMILY_PAGE"; + page_title: string = "Family Account"; + currency_url: string = + "https://www.wrenchboard.com/assets/images/apps/currency/"; - tabs = 'members'; - suggestion_total:number=0; - total_family:number = 0; - family_active:number = 0; - session_image_server:string=''; - curr_session:string=''; - etag:string=''; - currFamState:any; - family_action:string="DEFAULT_FAMILY_PAGE"; - page_title:string = 'Family Account'; - currency_url:string="https://www.wrenchboard.com/assets/images/apps/currency/"; - - walletData:[]; + walletData: []; constructor( - private navctr: NavController, - private router: Router, - public sessionDataProviderService: SessionDataProviderService, - private wrenchService: WrenchService, - public userWalletService: UserWalletService, - public familysuggestPendingService: FamilysuggestPendingService + private navctr: NavController, + private router: Router, + public sessionDataProviderService: SessionDataProviderService, + private wrenchService: WrenchService, + public userWalletService: UserWalletService, + public familysuggestPendingService: FamilysuggestPendingService ) { - this.etag = '' + Date.now(); - addEventListener('family_refresh_list', () => { - this.getFamilyData(); - }); - this.page_title = 'Family Account'; - this.currFamState = this.router.getCurrentNavigation().extras.state; - this.walletData = this.userWalletService.walletData; + this.etag = "" + Date.now(); + addEventListener("family_refresh_list", () => { + this.getFamilyData(); + }); + this.page_title = "Family Account"; + this.currFamState = this.router.getCurrentNavigation().extras.state; + this.walletData = this.userWalletService.walletData; - if ( this.currFamState != undefined && this.currFamState != null && this.currFamState.family_action != undefined){ - //debugger; - this.family_action = this.currFamState.family_action; - this.page_title= "Send Reward"; + if ( + this.currFamState != undefined && + this.currFamState != null && + this.currFamState.family_action != undefined + ) { + //debugger; + //this.currFamState.family_action = + this.family_action = this.currFamState.family_action; + + switch (this.family_action) { + case "FAMILY_ACTION_NO_TASKS": + this.page_title = "Assign Task or Chores"; + break; + case "FAMILY_ACTION_SEND_REWARD": + this.page_title = "Send Reward"; + break; } + } } - member_uid:string=''; + member_uid: string = ""; ngOnInit() { this.familysuggestPendingService.getFamilyPeningData(); // refresh data in store - this.member_uid= this.sessionDataProviderService.member_uid + this.member_uid = this.sessionDataProviderService.member_uid; this.getFamilyData(); this.familyPendingData = this.familysuggestPendingService.familyPendingData; this.suggestion_total = this.familysuggestPendingService.suggestionTotal; @@ -65,81 +77,90 @@ export class FamilyPage implements OnInit { this.navctr.back(); } - addCredit(item){ - this.router.navigate(['addcredit'],{state: item}); - } + addCredit(item) { + this.router.navigate(["addcredit"], { state: item }); + } - ionViewWillEnter() { - this.etag = '' + Date.now(); - } - familySettings(){ - this.router.navigate(['familysettings']); + ionViewWillEnter() { + this.etag = "" + Date.now(); + } + familySettings() { + this.router.navigate(["familysettings"]); } onMentor() { - this.router.navigate(['mentor']); + this.router.navigate(["mentor"]); } onEnroll() { - this.router.navigate(['enroll']); + this.router.navigate(["enroll"]); } - jobActive(item){ - this.router.navigate(['jobactive'],{state: item}); - } - familyMemebr(item){ - var famItem = { - jobManagerActiveData: this.jobManagerActiveData, - familyPendingData:this.familyPendingData, - itemData:item, - startPage: '' - }; - this.router.navigate(['familymember'],{state: famItem}); + jobActive(item) { + this.router.navigate(["jobactive"], { state: item }); + } + familyMemebr(item) { + var famItem = { + jobManagerActiveData: this.jobManagerActiveData, + familyPendingData: this.familyPendingData, + itemData: item, + startPage: "", + }; + this.router.navigate(["familymember"], { state: famItem }); } - familyMemeberToWallet(item){ - var famItem = { - jobManagerActiveData: this.jobManagerActiveData, - familyPendingData:this.familyPendingData, - itemData:item, - startPage: 'WALLET' - }; - this.router.navigate(['familymember'],{state: famItem}); - } + familyMemeberToWallet(item) { + var famItem = { + jobManagerActiveData: this.jobManagerActiveData, + familyPendingData: this.familyPendingData, + itemData: item, + startPage: "WALLET", + }; + this.router.navigate(["familymember"], { state: famItem }); + } usrData: { - action:number, member_id: number, uid: string, sessionid: string, limit:20, page:1,offset: 0 + action: number; + member_id: number; + uid: string; + sessionid: string; + limit: 20; + page: 1; + offset: 0; }; - familyTotalData:any; + familyTotalData: any; familyData: []; - getFamilyData(){ - this.usrData = {action:22010, + getFamilyData() { + this.usrData = { + action: 22010, member_id: this.sessionDataProviderService.member_id, uid: this.sessionDataProviderService.member_uid, - sessionid: this.sessionDataProviderService.session , - limit:20, page:1,offset: 0}; - this.curr_session = this.sessionDataProviderService.session; - - this.wrenchService.getFamilyList(this.usrData).subscribe( - familyTotalData => { - this.familyTotalData = familyTotalData; - console.log("FAMILY RETURN->", this.familyTotalData); - this.familyData = this.familyTotalData.result_list; - // debugger; - this.session_image_server = this.familyTotalData.session_image_server; - console.log("FAMILY RETURN DATA->", this.familyData); - this.total_family = this.familyData.length; - } - ); + sessionid: this.sessionDataProviderService.session, + limit: 20, + page: 1, + offset: 0, + }; + this.curr_session = this.sessionDataProviderService.session; + this.wrenchService + .getFamilyList(this.usrData) + .subscribe((familyTotalData) => { + this.familyTotalData = familyTotalData; + console.log("FAMILY RETURN->", this.familyTotalData); + this.familyData = this.familyTotalData.result_list; + // debugger; + this.session_image_server = this.familyTotalData.session_image_server; + console.log("FAMILY RETURN DATA->", this.familyData); + this.total_family = this.familyData.length; + }); } - familyPendingTotalData:any; + familyPendingTotalData: any; familyPendingData: []; - getFamilyPeningData(){ - - setTimeout(()=>{ - this.familyPendingData = this.familysuggestPendingService.familyPendingData; - this.suggestion_total = this.familysuggestPendingService.suggestionTotal; - }, 5000); + getFamilyPeningData() { + setTimeout(() => { + this.familyPendingData = + this.familysuggestPendingService.familyPendingData; + this.suggestion_total = this.familysuggestPendingService.suggestionTotal; + }, 5000); // this.usrData = {action:22010, // member_id: this.sessionDataProviderService.member_id, @@ -157,29 +178,36 @@ export class FamilyPage implements OnInit { // this.suggestion_total = this.familyPendingData.length; // } // ); - } - jobManagerActiveTotalData:any; - jobManagerActiveData: []; - getFamilyActiveJobsData(){ - this.usrData = {action:22010, - member_id: this.sessionDataProviderService.member_id, - uid: this.sessionDataProviderService.member_uid, - sessionid: this.sessionDataProviderService.session , - limit:20, page:1,offset: 0} + jobManagerActiveTotalData: any; + jobManagerActiveData: []; + getFamilyActiveJobsData() { + this.usrData = { + action: 22010, + member_id: this.sessionDataProviderService.member_id, + uid: this.sessionDataProviderService.member_uid, + sessionid: this.sessionDataProviderService.session, + limit: 20, + page: 1, + offset: 0, + }; - this.wrenchService.getJobsManagerData(this.usrData).subscribe( - jobManagerActiveTotalData => { - this.jobManagerActiveTotalData = jobManagerActiveTotalData; - console.log("jobManagerActiveTotalData RETURN->", this.jobManagerActiveTotalData); - this.jobManagerActiveData = this.jobManagerActiveTotalData.result_list; - // debugger; - console.log("jobManagerActiveTotalData RETURN DATA->", this.jobManagerActiveData); - this.family_active = this.jobManagerActiveData.length; - } + this.wrenchService + .getJobsManagerData(this.usrData) + .subscribe((jobManagerActiveTotalData) => { + this.jobManagerActiveTotalData = jobManagerActiveTotalData; + console.log( + "jobManagerActiveTotalData RETURN->", + this.jobManagerActiveTotalData ); - - } - + this.jobManagerActiveData = this.jobManagerActiveTotalData.result_list; + // debugger; + console.log( + "jobManagerActiveTotalData RETURN DATA->", + this.jobManagerActiveData + ); + this.family_active = this.jobManagerActiveData.length; + }); + } }