profile page
This commit is contained in:
@@ -2,6 +2,7 @@ import {Component, OnInit, ViewChild} from '@angular/core';
|
||||
import {SessionDataProviderService} from "../../store/session-data-provider.service";
|
||||
import {WrenchService} from "../../services/wrench.service";
|
||||
import {LoadingController, NavController} from "@ionic/angular";
|
||||
import {Router} from "@angular/router";
|
||||
|
||||
@Component({
|
||||
selector: 'app-addfamilykid',
|
||||
@@ -12,6 +13,9 @@ export class AddfamilykidPage implements OnInit {
|
||||
|
||||
@ViewChild('firstname') firstname;
|
||||
@ViewChild('lastname') lastname;
|
||||
|
||||
|
||||
|
||||
@ViewChild('month') month;
|
||||
@ViewChild('year') year;
|
||||
addFamilyResult:string='';
|
||||
@@ -20,6 +24,7 @@ export class AddfamilykidPage implements OnInit {
|
||||
constructor(
|
||||
private navctr: NavController,
|
||||
public sessionDataProviderService: SessionDataProviderService,
|
||||
private router: Router,
|
||||
private wrenchService: WrenchService,
|
||||
private loadingCtrl: LoadingController
|
||||
) { }
|
||||
@@ -32,7 +37,10 @@ export class AddfamilykidPage implements OnInit {
|
||||
//debugger;
|
||||
}
|
||||
|
||||
onBack() {
|
||||
onBack() {
|
||||
const pageToNavigate = "home";
|
||||
//dispatchEvent(new Event("force_profile_refresh"));
|
||||
// this.router.navigate([pageToNavigate],);
|
||||
this.navctr.back();
|
||||
}
|
||||
|
||||
@@ -93,7 +101,7 @@ export class AddfamilykidPage implements OnInit {
|
||||
if (this.createFamilyResult.internal_return> 0){
|
||||
this.firstname='';
|
||||
this.lastname='';
|
||||
|
||||
dispatchEvent(new Event("force_profile_refresh"));
|
||||
this.createFamilyResult = "Family Added";
|
||||
setTimeout(()=>{
|
||||
this.createFamilyResult="";
|
||||
|
||||
@@ -33,23 +33,35 @@
|
||||
<ion-card-content>
|
||||
|
||||
<ion-item lines="none">
|
||||
<ion-input type="text" maxlength="15" placeholder="Firstname" [(ngModel)]='firstname' ></ion-input>
|
||||
<ion-input type="text" (ionChange)="verifyP()" maxlength="15" placeholder="Firstname" [(ngModel)]='firstname' ></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item lines="none">
|
||||
<ion-input type="text" maxlength="15" placeholder="lastname" [(ngModel)]='lastname' ></ion-input>
|
||||
<ion-input type="text" (ionChange)="verifyP()" maxlength="15" placeholder="lastname" [(ngModel)]='lastname' ></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item lines="none">
|
||||
<ion-input type="text" maxlength="35" placeholder="Email" [(ngModel)]='email' ></ion-input>
|
||||
<ion-input type="text" (ionChange)="verifyP()" maxlength="35" placeholder="Email" [(ngModel)]='email' ></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item lines="none">
|
||||
<ion-input type="text" (ionChange)="verifyP()" maxlength="15" placeholder="City" [(ngModel)]='city' ></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item lines="none">
|
||||
<ion-input type="text" (ionChange)="verifyP()" maxlength="15" placeholder="State" [(ngModel)]='state' ></ion-input>
|
||||
</ion-item>
|
||||
|
||||
|
||||
<ion-item lines="none">
|
||||
<ion-input type="text" maxlength="14" placeholder="Online Name" [(ngModel)]='online_name' ></ion-input>
|
||||
</ion-item>
|
||||
<div style="text-align: right;">
|
||||
{{profileMessage}}
|
||||
<ion-button shape="round" size="small" (click)="sendUpdateProfile()">Update</ion-button>
|
||||
<ion-button
|
||||
shape="round"
|
||||
[disabled]="isDisabled"
|
||||
(click)="sendUpdateProfile()">Update</ion-button>
|
||||
</div>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
|
||||
@@ -16,6 +16,7 @@ ion-header {
|
||||
ion-content {
|
||||
ion-card{
|
||||
margin: 0px;
|
||||
background-image: linear-gradient(to right, aliceblue, #f1f3f5,#fcfdfd,white,#fcfdfd,#f1f3f5,aliceblue);
|
||||
}
|
||||
.profile {
|
||||
display: flex;
|
||||
|
||||
@@ -34,24 +34,39 @@ export class EditProfilePage implements OnInit {
|
||||
email:string='';
|
||||
online_name:string='';
|
||||
profilePicture:string='';
|
||||
|
||||
city:string='';
|
||||
state:string='';
|
||||
user_state:string='';
|
||||
ngOnInit() {
|
||||
this.firstname = this.sessionDataProviderService.firstname;
|
||||
this.lastname = this.sessionDataProviderService.lastname;
|
||||
this.city = this.sessionDataProviderService.city;
|
||||
this.state = this.sessionDataProviderService.user_state;
|
||||
this.online_name = this.sessionDataProviderService.online_name;
|
||||
|
||||
|
||||
this.email = this.sessionDataProviderService.email;
|
||||
this.online_name = this.sessionDataProviderService.online_name;
|
||||
this.etag = '' + Date.now();
|
||||
this.profilePicture = this.sessionDataProviderService.profilePicture(this.sessionDataProviderService.session, this.sessionDataProviderService.member_uid)+'?'+this.etag;
|
||||
setInterval(()=>{
|
||||
|
||||
var myIframe=document.getElementById('profile_pic');
|
||||
myIframe.style.backgroundImage=myIframe.style.backgroundImage;
|
||||
|
||||
//document.getElementById("profile_pic").style.background="'url('"+this.profilePicture+"')'"; ///this.profilePicture;
|
||||
// this.onBack();
|
||||
}, 5000);
|
||||
// document.getElementById("profile_pic").reload(true);
|
||||
}
|
||||
|
||||
|
||||
isDisabled:boolean= true;
|
||||
verifyP(){
|
||||
this.isDisabled= true;
|
||||
if ( this.firstname.length> 1
|
||||
&& this.lastname.length> 1
|
||||
&& this.city.length> 3 && this.state.length> 1
|
||||
){
|
||||
this.isDisabled= false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ionViewWillEnter() {
|
||||
this.etag = '' + Date.now();
|
||||
}
|
||||
@@ -105,8 +120,8 @@ export class EditProfilePage implements OnInit {
|
||||
firstname: this.firstname,
|
||||
lastname: this.lastname,
|
||||
email: this.email,
|
||||
state: this.sessionDataProviderService.user_state,
|
||||
city: this.sessionDataProviderService.city,
|
||||
state: this.state,
|
||||
city: this.city,
|
||||
online_name: this.online_name,
|
||||
pref_email: this.sessionDataProviderService.pref_email,
|
||||
pref_phone: this.sessionDataProviderService.pref_phone,
|
||||
@@ -121,6 +136,7 @@ export class EditProfilePage implements OnInit {
|
||||
if (this.profileResult?.internal_return==0){
|
||||
this.profileMessage="Profile Updated";
|
||||
dispatchEvent(new Event("profile_picture_updated"));
|
||||
dispatchEvent(new Event("force_profile_refresh"));
|
||||
setTimeout(()=>{
|
||||
this.etag = '' + Date.now();
|
||||
this.profileMessage='';
|
||||
|
||||
@@ -59,10 +59,35 @@ export class HomePage implements OnInit {
|
||||
addEventListener('dash_tool_mywallet', () => {
|
||||
this.myWallet();
|
||||
});
|
||||
|
||||
addEventListener('force_profile_refresh', () => {
|
||||
this.forceProfileRefresh();
|
||||
});
|
||||
|
||||
this.home_dash_type = this.sessionDataProviderService.home_dash_type;
|
||||
//this.home_dash_type = 'FAMILY_PARENT_DASH';
|
||||
}
|
||||
|
||||
async forceProfileRefresh(){
|
||||
|
||||
this.usrData = {
|
||||
action:15030,
|
||||
member_id: this.sessionDataProviderService.member_id,
|
||||
uid: this.sessionDataProviderService.member_uid,
|
||||
sessionid: this.sessionDataProviderService.session,
|
||||
'limit': 30,
|
||||
'offset': 0
|
||||
};
|
||||
this.wrenchService.getProfile(this.usrData).subscribe(
|
||||
profileResult => {
|
||||
console.log("profileResult RETURN DATA->", profileResult );
|
||||
if( profileResult != null){
|
||||
this.sessionDataProviderService.RefreshGlobalSessionData(profileResult);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
allInitFunctions(){
|
||||
if ( this.sessionDataProviderService.member_uid != ''){
|
||||
this.onesignalService.Init(this.sessionDataProviderService.member_uid);
|
||||
@@ -75,59 +100,38 @@ export class HomePage implements OnInit {
|
||||
// no need moved to components this.getFamilySuggestList();
|
||||
}
|
||||
}
|
||||
|
||||
//debugger;
|
||||
|
||||
|
||||
// this.walletPresentation();
|
||||
}
|
||||
ngOnInit() {
|
||||
this.allInitFunctions();
|
||||
|
||||
|
||||
}
|
||||
setProfilePicture(){
|
||||
this.accountType = this.sessionDataProviderService.account_type;
|
||||
this.etag = '' + Date.now();
|
||||
if (this.accountType == 'FULL'){
|
||||
// this.profilePicture = this.sessionDataProviderService.profilePicture(this.sessionDataProviderService.session, this.sessionDataProviderService.member_uid);
|
||||
this.profilePicture = this.sessionDataProviderService.profilePicture(this.sessionDataProviderService.session, this.sessionDataProviderService.member_uid)+'?'+this.etag;
|
||||
/// debugger;
|
||||
}
|
||||
|
||||
if (this.accountType == 'FAMILY'){
|
||||
this.profilePicture = this.sessionDataProviderService.profilePicture(this.sessionDataProviderService.session, this.sessionDataProviderService.family_uid)+'?'+this.etag;
|
||||
}
|
||||
}
|
||||
ionViewWillEnter(){
|
||||
console.log('Home page did enter - > ionViewWillEnter');
|
||||
this.allInitFunctions();
|
||||
}
|
||||
// async walletPresentation(){
|
||||
// this.walletData = this.userWalletService.getWallet();
|
||||
// if( this.walletData?.length > 0 ) {
|
||||
// var num = new Number(this.walletData[0].amount*0.01);
|
||||
// //this.fee_display = num.toFixed(2); //outputs 14
|
||||
// this.walletDescription = num.toFixed(2) + ' ' + this.walletData[0].description;
|
||||
// }
|
||||
// }
|
||||
|
||||
goPlayground(){
|
||||
this.router.navigate(['playground']);
|
||||
}
|
||||
ionViewDidEnter(){
|
||||
if (this.accountType == 'FULL'){
|
||||
// this.profilePicture = this.sessionDataProviderService.profilePicture(this.sessionDataProviderService.session, this.sessionDataProviderService.member_uid);
|
||||
this.getBlogData([]);
|
||||
this.getBannersData();
|
||||
}
|
||||
|
||||
if (this.accountType == 'FAMILY'){
|
||||
// this.profilePicture = this.sessionDataProviderService.profilePicture(this.sessionDataProviderService.session, this.sessionDataProviderService.family_uid);
|
||||
this.getFamilySuggestList();
|
||||
}
|
||||
|
||||
this. setProfilePicture();
|
||||
}
|
||||
|
||||
blogResult:any;
|
||||
bannerResult:any;
|
||||
bannerData: [];
|
||||
@@ -143,12 +147,6 @@ export class HomePage implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
// 'member_id' => int 1
|
||||
// 'sessionid' => string '6AD58B08A9F458E6E6819DD603E202C657DB9BFFDD956C16386CC65975CE0D53' (length=64)
|
||||
// 'uid' => string '3119b744-42ad-4834-bb83-b737588754ca' (length=36)
|
||||
// 'action' => int 11200
|
||||
//
|
||||
|
||||
async refreshBannersData(){
|
||||
this.bannerData = this.bannersDataService.bannerData;
|
||||
this.homebannerCount = this.bannersDataService.homebannerCount;
|
||||
@@ -166,22 +164,6 @@ export class HomePage implements OnInit {
|
||||
var interval = setInterval( ()=> {
|
||||
this.refreshBannersData();
|
||||
}, 5000);
|
||||
|
||||
|
||||
// this.usrData = {action:11200, member_id: this.sessionDataProviderService.member_id, uid: this.sessionDataProviderService.member_uid,
|
||||
// sessionid: this.sessionDataProviderService.session,'limit': 30,
|
||||
// 'offset': 0 }
|
||||
// this.wrenchService.getHomeBanners(this.usrData).subscribe(
|
||||
// bannerResult => {
|
||||
// this.bannerResult = bannerResult;
|
||||
// console.log("BANNERS RETURN->", this.bannerResult);
|
||||
// this.bannerData = this.bannerResult.result_list;
|
||||
// this.homebannerCount = this.bannerData.length;
|
||||
// // debugger;
|
||||
// console.log("BANNERS RETURN DATA->", this.bannerData);
|
||||
// // this.blogDataService.setBlogData(this.blogResult.blog_data);
|
||||
// }
|
||||
// );
|
||||
}
|
||||
|
||||
familySuggestResult:any;
|
||||
|
||||
@@ -283,6 +283,10 @@ export class WrenchService {
|
||||
return this.getPostData("updateprofile", profileData);
|
||||
}
|
||||
|
||||
getProfile(profileData) {
|
||||
return this.getPostData("loadprofile", profileData);
|
||||
}
|
||||
|
||||
offferResponse(respData){
|
||||
return this.getPostData("offersresponse", respData);
|
||||
}
|
||||
|
||||
@@ -130,6 +130,38 @@ export class SessionDataProviderService {
|
||||
return arrY;
|
||||
}
|
||||
|
||||
RefreshGlobalSessionData(loginResult: any){
|
||||
this.account_type = loginResult.account_type;
|
||||
this.firstname = loginResult.firstname;
|
||||
this.lastname = loginResult.lastname;
|
||||
this.session = loginResult.session;
|
||||
this.session_contructed=loginResult.balance;
|
||||
this.email = loginResult.email;
|
||||
this.username=loginResult.username;
|
||||
this.last_login = loginResult.last_login2;
|
||||
// this.profile_pic=loginResult.profile_pic;
|
||||
// this.profile_pic_url = loginResult.profile_pic_url;
|
||||
// this.isPedningJob = loginResult.pedningjob;
|
||||
// this.isOfferJob = loginResult.offerjob;
|
||||
this.user_state=loginResult.state;
|
||||
// this.city = loginResult.city;
|
||||
// this.online_name = loginResult.online_name;
|
||||
// this.pref_email= loginResult.pref_email;
|
||||
// this.pref_phone = loginResult.pref_phone;
|
||||
// this.promo=loginResult.promo;
|
||||
// this.active_job_count = loginResult.active_job_count;
|
||||
// this.tracking = loginResult.tracking;
|
||||
// this.session_image_server = loginResult.session_image_server;
|
||||
// this.refresh = loginResult.refresh;
|
||||
// this.family_types= loginResult.family_types;
|
||||
// this.history_types =loginResult.history_types;
|
||||
this.home_dash_type = (loginResult.home_dash_type != null)? loginResult.home_dash_type : 'DEFAULT_HOME_DASH';
|
||||
this.family_action =loginResult.family_action;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
ConstructGlobalSessionData(loginResult: any) {
|
||||
console.log('Hello ConstructGlobalSessionData Provider');
|
||||
this.session_contructed=false;
|
||||
|
||||
Reference in New Issue
Block a user