Commit 98edb4ff by muhsin

added dob,

parent c56c1ad8
...@@ -17,20 +17,34 @@ ...@@ -17,20 +17,34 @@
<input <input
[(value)]="userData && userData.name" [(value)]="userData && userData.name"
name="name" name="name"
required readonly
class="" class=""
type="text" type="text"
[(ngModel)]="userData && userData.name"
placeholder="Change your Name" placeholder="Change your Name"
#name="ngModel"
/> />
<div <!-- <div
class="md-errors-spacer" class="md-errors-spacer"
[hidden]="name.valid" [hidden]="name.valid"
class="ion-padding-start" class="ion-padding-start"
> >
Name is required Name is required
</div> -->
</div> </div>
<div class="row">
<input
[(value)]="userData && userData.dob"
name="dob"
readonly
class=""
type="text"
/>
<!-- <div
class="md-errors-spacer"
[hidden]="name.valid"
class="ion-padding-start"
>
Name is required
</div> -->
</div> </div>
<div class="row"> <div class="row">
<input <input
...@@ -122,7 +136,7 @@ ...@@ -122,7 +136,7 @@
<button <button
class="login_btn" class="login_btn"
(click)="onFormSubmit(updateForm)" (click)="onFormSubmit(updateForm)"
[disabled]="!phone.valid || !name.valid" [disabled]="!phone.valid "
> >
UPDATE UPDATE
</button> </button>
......
...@@ -14,7 +14,7 @@ import { NgForm } from '@angular/forms'; ...@@ -14,7 +14,7 @@ import { NgForm } from '@angular/forms';
export class ChangedetailsPage implements OnInit { export class ChangedetailsPage implements OnInit {
userData: any; userData: any;
updateData: UpdateUserDetails = { updateData: UpdateUserDetails = {
name: '', phoneVerified: false,
phone: '' phone: ''
}; };
confPasswordErr: string; confPasswordErr: string;
...@@ -65,7 +65,8 @@ export class ChangedetailsPage implements OnInit { ...@@ -65,7 +65,8 @@ export class ChangedetailsPage implements OnInit {
// Change Password // Change Password
if ( if (
form.value.currentPassword && form.value.currentPassword &&
form.value.password && form.value.password === form.value.confirmPassword form.value.password &&
form.value.password === form.value.confirmPassword
) { ) {
this.register.updateData(form.value, this.userData.uid); this.register.updateData(form.value, this.userData.uid);
this.register.updatePassword( this.register.updatePassword(
......
...@@ -23,10 +23,9 @@ import { Signup } from './../../config/services/user'; ...@@ -23,10 +23,9 @@ import { Signup } from './../../config/services/user';
] ]
}) })
export class SignupPage implements OnInit { export class SignupPage implements OnInit {
menuShow = false; menuShow = false;
currDate = new Date(); currDate = new Date();
mobnumPattern = '(\(+61\)|\+61|\(0[1-9]\)|0[1-9])?( ?-?[0-9]){6,10}'; mobnumPattern = '((+61)|+61|(0[1-9])|0[1-9])?( ?-?[0-9]){6,10}';
minDate: any; minDate: any;
signup: Signup = { signup: Signup = {
emailId: '', emailId: '',
...@@ -47,14 +46,19 @@ export class SignupPage implements OnInit { ...@@ -47,14 +46,19 @@ export class SignupPage implements OnInit {
console.log(this.currDate.getFullYear() - 10); console.log(this.currDate.getFullYear() - 10);
this.currDate.setFullYear(this.currDate.getFullYear() - 10); this.currDate.setFullYear(this.currDate.getFullYear() - 10);
console.log(this.currDate); console.log(this.currDate);
const month = this.currDate.getMonth() + 1 < 10 ? '0' + (this.currDate.getMonth() + 1) : '' + (this.currDate.getMonth() + 1), const month =
day = this.currDate.getDate() < 10 ? '0' + this.currDate.getDate() : this.currDate.getDate(), this.currDate.getMonth() + 1 < 10
? '0' + (this.currDate.getMonth() + 1)
: '' + (this.currDate.getMonth() + 1),
day =
this.currDate.getDate() < 10
? '0' + this.currDate.getDate()
: this.currDate.getDate(),
year = this.currDate.getFullYear(); year = this.currDate.getFullYear();
this.minDate = [year, month, day].join('-'); this.minDate = [year, month, day].join('-');
} }
ngOnInit() { ngOnInit() {}
}
goToPage(path, data = null) { goToPage(path, data = null) {
this.router.navigateByUrl(path, { queryParams: data }); this.router.navigateByUrl(path, { queryParams: data });
...@@ -77,7 +81,4 @@ export class SignupPage implements OnInit { ...@@ -77,7 +81,4 @@ export class SignupPage implements OnInit {
this.register.signup(form.value); this.register.signup(form.value);
} }
} }
} }
...@@ -171,6 +171,7 @@ export class AuthService { ...@@ -171,6 +171,7 @@ export class AuthService {
uid: value.uid, uid: value.uid,
emailId: value.emailId, emailId: value.emailId,
name: value.name, name: value.name,
dob: value.dob,
profilePhoto: value.profilePhoto, profilePhoto: value.profilePhoto,
emailVerified: value.emailVerified, emailVerified: value.emailVerified,
phone: value.phone, phone: value.phone,
...@@ -210,6 +211,7 @@ export class AuthService { ...@@ -210,6 +211,7 @@ export class AuthService {
const postData: User = { const postData: User = {
uid: userData.uid, uid: userData.uid,
status: true, status: true,
dob: userData.dob ? userData.dob : '',
profilePhoto: userData.photoURL, profilePhoto: userData.photoURL,
phoneVerified: false, phoneVerified: false,
phone: userData.phoneNumber, phone: userData.phoneNumber,
...@@ -247,8 +249,10 @@ export class AuthService { ...@@ -247,8 +249,10 @@ export class AuthService {
symbol: 'A$' symbol: 'A$'
}; };
const custData = result.user; const custData = result.user;
const dobDate = new Date(userData.dob);
const postData: User = { const postData: User = {
uid: custData.uid, uid: custData.uid,
dob: dobDate.toDateString(),
status: true, status: true,
profilePhoto: '', profilePhoto: '',
phoneVerified: false, phoneVerified: false,
...@@ -268,6 +272,7 @@ export class AuthService { ...@@ -268,6 +272,7 @@ export class AuthService {
.set(postData) .set(postData)
.then(() => { .then(() => {
console.log('successs'); console.log('successs');
this.service.set('userData', JSON.stringify(postData));
}); });
this.loader = false; this.loader = false;
}) })
......
...@@ -7,6 +7,7 @@ export interface User { ...@@ -7,6 +7,7 @@ export interface User {
profilePhoto: string; profilePhoto: string;
emailVerified: boolean; emailVerified: boolean;
status: boolean; status: boolean;
dob: string;
loginType: number; loginType: number;
otp: string; otp: string;
currency: { currency: {
...@@ -27,7 +28,8 @@ export interface Signup { ...@@ -27,7 +28,8 @@ export interface Signup {
// Model for Change Details page // Model for Change Details page
export interface UpdateUserDetails { export interface UpdateUserDetails {
name: string; // name: string;
phoneVerified: boolean;
phone: string; phone: string;
} }
// Model to Update Password // Model to Update Password
......
...@@ -57,12 +57,13 @@ export class UpdateService { ...@@ -57,12 +57,13 @@ export class UpdateService {
const postData: UpdateUserDetails = { const postData: UpdateUserDetails = {
phone: userData.phone, phone: userData.phone,
name: userData.name phoneVerified: false
// name: userData.name
}; };
const updateOldData = { const updateOldData = {
...oldData, ...oldData,
phone: userData.phone, phone: userData.phone
name: userData.name // name: userData.name
}; };
this.userPostData = postData; this.userPostData = postData;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment