contacts
This commit is contained in:
@@ -63,8 +63,27 @@
|
||||
<ion-label>Invite from Contacts</ion-label>
|
||||
</ion-item>
|
||||
<div class="ion-padding" slot="content" style="background-color: white; padding: 5px">
|
||||
<div style="margin-top: 10px; background-color: aliceblue; min-height: 150px;">
|
||||
<ion-button (click)="refreshContacts()">Refresh Contacts</ion-button>
|
||||
<div style="margin-top: 10px; background-color: aliceblue; min-height: 150px; border-radius: 10px;">
|
||||
<ion-grid>
|
||||
<ion-row style="padding: 0px; margin: 0px;">
|
||||
<ion-col style="padding: 0px; margin: 0px;">
|
||||
<ion-searchbar animated="true" placeholder="Search Contacts" style="margin: 0px;"></ion-searchbar>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
|
||||
|
||||
</div>
|
||||
<div style="padding: 0px 10px 0px 10px;">
|
||||
<ion-button (click)="refreshContacts()"
|
||||
shape="round"
|
||||
expand="block"
|
||||
size="small">Refresh Contacts</ion-button>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Component, OnInit, ViewChild} from '@angular/core';
|
||||
import {NavController} from "@ionic/angular";
|
||||
import {LoadingController, 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";
|
||||
@@ -25,7 +25,8 @@ export class InvitePage implements OnInit {
|
||||
public sessionDataProviderService: SessionDataProviderService,
|
||||
private wrenchService: WrenchService,
|
||||
private alertController: AlertController,
|
||||
private contactsDataService:ContactsDataService
|
||||
private contactsDataService:ContactsDataService,
|
||||
private loadingCtrl: LoadingController,
|
||||
) {
|
||||
}
|
||||
/*
|
||||
@@ -41,7 +42,11 @@ export class InvitePage implements OnInit {
|
||||
action:number, member_id: number, uid: string, sessionid: string, ref_firstname:string, ref_lastname:string,ref_email: string
|
||||
};
|
||||
sendReferResult:any;
|
||||
sendRefer(){
|
||||
async sendRefer(){
|
||||
const loading = await this.loadingCtrl.create({
|
||||
message: 'Sending ... ',
|
||||
duration: 3500,
|
||||
});
|
||||
|
||||
if (this.ref_firstname=="" || this.lastname=="" || !this.validateEmail(this.email) ){
|
||||
this.showAlert('Refer Error', 'Email and names required');
|
||||
@@ -57,8 +62,10 @@ export class InvitePage implements OnInit {
|
||||
ref_lastname:this.lastname,
|
||||
ref_email:this.email
|
||||
};
|
||||
loading.present();
|
||||
this.wrenchService.sendRefer(this.referSendData).subscribe(
|
||||
sendReferResult => {
|
||||
loading.dismiss();
|
||||
this.sendReferResult = sendReferResult;
|
||||
if ( this.sendReferResult.internal_return == 0 ){
|
||||
this.showAlert('Refer Sent', 'Message sent to '+ this.email);
|
||||
@@ -130,7 +137,11 @@ export class InvitePage implements OnInit {
|
||||
// alert.present();
|
||||
// // alert(amessage);
|
||||
}
|
||||
refreshContacts(){
|
||||
async refreshContacts(){
|
||||
const loading = await this.loadingCtrl.create({
|
||||
message: 'Please wait ... ',
|
||||
duration: 3500,
|
||||
});
|
||||
this.contactsDataService.refeshContacts();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,6 +171,10 @@ export class WrenchService {
|
||||
getFamilyPeningList(usrData) {
|
||||
return this.getPostData("familywaitingtasks", usrData);
|
||||
}
|
||||
|
||||
processUsersContacts(usrData) {
|
||||
return this.getPostData("cachecontacts", usrData);
|
||||
}
|
||||
getUserWallets(usrData) {
|
||||
return this.getPostData("getwallets", usrData);
|
||||
}
|
||||
|
||||
@@ -4,13 +4,16 @@ import { Plugin} from "@capacitor/core";
|
||||
//const { Contacts } = Plugins;
|
||||
|
||||
import { isPlatform } from "@ionic/angular";
|
||||
import {SessionDataProviderService} from "./session-data-provider.service";
|
||||
import {WrenchService} from "../services/wrench.service";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ContactsDataService {
|
||||
|
||||
constructor() { }
|
||||
constructor(public sessionDataProviderService:SessionDataProviderService,
|
||||
private wrenchService: WrenchService) { }
|
||||
|
||||
|
||||
async refeshContacts(){
|
||||
@@ -28,6 +31,40 @@ export class ContactsDataService {
|
||||
emails: true
|
||||
}}).then( result=>{
|
||||
console.log(result);
|
||||
this.cacheContactsForAccount(result);
|
||||
});
|
||||
}
|
||||
|
||||
usrData: {
|
||||
action:number,
|
||||
member_id: number,
|
||||
uid: string,
|
||||
sessionid: string,
|
||||
raw_contacts : string
|
||||
};
|
||||
pPesult:any;
|
||||
async cacheContactsForAccount(contactResult){
|
||||
this.usrData = {action:22010,
|
||||
member_id: this.sessionDataProviderService.member_id,
|
||||
uid: this.sessionDataProviderService.member_uid,
|
||||
sessionid: this.sessionDataProviderService.session ,
|
||||
raw_contacts: contactResult.toString()}
|
||||
|
||||
this.wrenchService.processUsersContacts(this.usrData).subscribe(
|
||||
pPesult => {
|
||||
this.pPesult = pPesult;
|
||||
console.log("pPesult RETURN->", this.pPesult);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
suggestionTotal:number = 0;
|
||||
familyPendingTotalData:any;
|
||||
familyPendingData: [];
|
||||
|
||||
|
||||
// async getFamilyPeningData(){
|
||||
//
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user