Commit 86664af8 by Adarsh K

Merge branch 'muhsin' into 'master'

Muhsin See merge request !54
parents d0836db7 4995603e
.address-wrapper { .address-wrapper {
padding: 15px; padding: 15px;
padding-bottom: 11%;
.address-radio { .address-radio {
background-image: url("../../assets/radio.png"); background-image: url('../../assets/radio.png');
-webkit-appearance: none; -webkit-appearance: none;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
...@@ -10,12 +11,12 @@ ...@@ -10,12 +11,12 @@
padding: 15px; padding: 15px;
border-radius: 5px; border-radius: 5px;
outline: none; outline: none;
transition: all .6s ease-in-out; transition: all 0.6s ease-in-out;
} }
.address-radio:checked { .address-radio:checked {
background-image: url("../../assets/radio-checked.png"); background-image: url('../../assets/radio-checked.png');
} }
.address-radio:checked+.show-btn { .address-radio:checked + .show-btn {
opacity: 1; opacity: 1;
} }
h1 { h1 {
...@@ -26,7 +27,7 @@ ...@@ -26,7 +27,7 @@
p { p {
margin-top: 20px; margin-top: 20px;
padding-left: 10px; padding-left: 10px;
color: #B0AEC7; color: #b0aec7;
} }
button { button {
background: none; background: none;
...@@ -39,8 +40,11 @@ ...@@ -39,8 +40,11 @@
.address-btn-wrapper { .address-btn-wrapper {
padding: 15px; padding: 15px;
position: absolute; padding-top: 0;
bottom: 50px; padding-bottom: 10px;
background-color: #fff;
position: fixed;
bottom: 0px;
left: 0; left: 0;
right: 0; right: 0;
button { button {
......
...@@ -139,34 +139,59 @@ ...@@ -139,34 +139,59 @@
<p>COD</p> <p>COD</p>
</label> </label>
</div> </div>
<!-- <div class="payment_method"> <div class="payment_method">
<input type="radio" name="payments" id="paypal" name="radio-group" checked (click)="getwaypaypal()"> <input
type="radio"
name="payments"
id="paypal"
name="radio-group"
checked
(click)="getwaypaypal()"
/>
<label for="test1"> <label for="test1">
<p>PayPal</p> <p>PayPal</p>
</label> </label>
</div> </div>
<div class="card_div" [hidden]="gateway !=1"> <div class="card_div" [hidden]="gateway !=1">
<input class="card_no borderNone widthFull" placeholder="PayPal ID"> <input
class="card_no borderNone widthFull"
placeholder="PayPal ID"
/>
</div> </div>
<div class="payment_method"> <div class="payment_method">
<input type="radio" name="payments" id="afterpay" name="radio-group" (click)="getwayafterpay()"> <input
type="radio"
name="payments"
id="afterpay"
name="radio-group"
(click)="getwayafterpay()"
/>
<label for="test2"> <label for="test2">
<p>AfterPay</p> <p>AfterPay</p>
</label> </label>
</div> </div>
<div class="card_div" [hidden]="gateway !=2"> <div class="card_div" [hidden]="gateway !=2">
<input class="card_no" placeholder="**** **** **** 1458"> <input class="card_no" placeholder="**** **** **** 1458" />
<input class="cv_number" placeholder="CVV"> <input class="cv_number" placeholder="CVV" />
</div> </div>
<div class="payment_method"> <div class="payment_method">
<input type="radio" name="payments" id="payk" name="radio-group" (click)="getwaypayk()"> <input
type="radio"
name="payments"
id="payk"
name="radio-group"
(click)="getwaypayk()"
/>
<label for="test3"> <label for="test3">
<p>PayK</p> <p>PayK</p>
</label> </label>
</div> </div>
<div class="card_div" [hidden]="gateway !=3"> <div class="card_div" [hidden]="gateway !=3">
<input class="card_no borderNone widthFull" placeholder="PafyK ID"> <input
</div> --> class="card_no borderNone widthFull"
placeholder="PafyK ID"
/>
</div>
<!-- <div class="delivery_time"> <!-- <div class="delivery_time">
<ul> <ul>
<li> <li>
...@@ -262,7 +287,7 @@ ...@@ -262,7 +287,7 @@
[hidden]="currentIndex != 0" [hidden]="currentIndex != 0"
> >
<div class="continue" (click)="goToPage('productlist')"> <div class="continue" (click)="goToPage('productlist')">
CONTINUE SHOPING CONTINUE SHOPPING
</div> </div>
<div class="checkout" (click)="next(1)">CHECKOUT</div> <div class="checkout" (click)="next(1)">CHECKOUT</div>
</div> </div>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
p { p {
margin: 0px; margin: 0px;
text-align: right; text-align: right;
background-image: url("../../assets/Path 55_2.png"); background-image: url('../../assets/Path 55_2.png');
background-position: left; background-position: left;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 12px; background-size: 12px;
...@@ -173,6 +173,7 @@ ...@@ -173,6 +173,7 @@
} }
.featured_catagory_list { .featured_catagory_list {
padding: 10px; padding: 10px;
padding-bottom: 14%;
ul { ul {
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
...@@ -278,14 +279,14 @@ ...@@ -278,14 +279,14 @@
.styled-checkbox { .styled-checkbox {
position: absolute; // take it out of document flow position: absolute; // take it out of document flow
opacity: 0; // hide it opacity: 0; // hide it
&+label { & + label {
position: relative; position: relative;
cursor: pointer; cursor: pointer;
padding: 0; padding: 0;
width: 100%; width: 100%;
} }
// Box. // Box.
&+label:before { & + label:before {
content: ''; content: '';
margin-right: 10px; margin-right: 10px;
display: inline-block; display: inline-block;
...@@ -296,21 +297,21 @@ ...@@ -296,21 +297,21 @@
background: white; background: white;
border: 1px solid rgba(215, 213, 228, 1); border: 1px solid rgba(215, 213, 228, 1);
} }
&:checked+label:before { &:checked + label:before {
background: #29285b; background: #29285b;
} }
// Disabled state label. // Disabled state label.
&:disabled+label { &:disabled + label {
color: #b8b8b8; color: #b8b8b8;
cursor: auto; cursor: auto;
} }
// Disabled box. // Disabled box.
&:disabled+label:before { &:disabled + label:before {
box-shadow: none; box-shadow: none;
background: #ddd; background: #ddd;
} }
// Checkmark. Could be replaced with an image // Checkmark. Could be replaced with an image
&:checked+label:after { &:checked + label:after {
content: ''; content: '';
position: absolute; position: absolute;
left: 6px; left: 6px;
...@@ -318,7 +319,8 @@ ...@@ -318,7 +319,8 @@
background: white; background: white;
width: 2px; width: 2px;
height: 2px; height: 2px;
box-shadow: 2px 0 0 white, 4px 0 0 white, 4px -2px 0 white, 4px -4px 0 white, 4px -6px 0 white, 4px -8px 0 white; box-shadow: 2px 0 0 white, 4px 0 0 white, 4px -2px 0 white,
4px -4px 0 white, 4px -6px 0 white, 4px -8px 0 white;
transform: rotate(45deg); transform: rotate(45deg);
} }
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
class="" class=""
type="text" type="text"
[(ngModel)]="userData && userData.name" [(ngModel)]="userData && userData.name"
[(placeholder)]="userData && userData.name" placeholder="Change your Name"
#name="ngModel" #name="ngModel"
/> />
<div <div
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
class="" class=""
name="emailId" name="emailId"
type="mail" type="mail"
[(placeholder)]="userData && userData.emailId" placeholder="email cannot be changed"
/> />
</div> </div>
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
pattern="(\(+61\)|\+61|\(0[1-9]\)|0[1-9])?( ?-?[0-9]){6,9}" pattern="(\(+61\)|\+61|\(0[1-9]\)|0[1-9])?( ?-?[0-9]){6,9}"
maxlength="10" maxlength="10"
[(ngModel)]="userData && userData.phone" [(ngModel)]="userData && userData.phone"
[(placeholder)]="userData && userData.phone" placeholder="Change your Phone Number"
#phone="ngModel" #phone="ngModel"
/> />
<div <div
...@@ -72,9 +72,22 @@ ...@@ -72,9 +72,22 @@
<div class="row"> <div class="row">
<h6>Change Password</h6> <h6>Change Password</h6>
</div> </div>
<!-- <div class="row"> <div class="row">
<input class="" type="password" placeholder="Current Password" /> <input
</div> --> class=""
type="password"
minlength="6"
#currentPassword="ngModel"
[(ngModel)]="updatePassword.currentPassword"
name="currentPassword"
placeholder="Current Password"
/>
<div
*ngIf="currentPassword.errors && currentPassword.errors.minlength"
>
Password must be at least 6 characters
</div>
</div>
<div class="row"> <div class="row">
<input <input
class="" class=""
...@@ -83,6 +96,7 @@ ...@@ -83,6 +96,7 @@
type="password" type="password"
placeholder="New Password" placeholder="New Password"
minlength="6" minlength="6"
[required]="currentPassword ? true: false"
#password="ngModel" #password="ngModel"
/> />
<div *ngIf="password.errors && password.errors.minlength"> <div *ngIf="password.errors && password.errors.minlength">
...@@ -96,10 +110,11 @@ ...@@ -96,10 +110,11 @@
[(ngModel)]="updatePassword.confirmPassword" [(ngModel)]="updatePassword.confirmPassword"
name="confirmPassword" name="confirmPassword"
type="password" type="password"
[required]="currentPassword ? true: false"
placeholder="Confirm Password" placeholder="Confirm Password"
/> />
<div *ngIf=""> <div *ngIf="confirmPassword.errors">
Password should match {{confPasswordErr}}
</div> </div>
</div> </div>
</div> </div>
...@@ -112,3 +127,10 @@ ...@@ -112,3 +127,10 @@
</form> </form>
</div> </div>
</ion-content> </ion-content>
<div class="loader" *ngIf="register.loader">
<div class="lds-ripple">
<div></div>
<div></div>
</div>
</div>
...@@ -17,6 +17,7 @@ export class ChangedetailsPage implements OnInit { ...@@ -17,6 +17,7 @@ export class ChangedetailsPage implements OnInit {
name: '', name: '',
phone: '' phone: ''
}; };
confPasswordErr: string;
updatePassword: UpdatePassword = { updatePassword: UpdatePassword = {
password: '', password: '',
...@@ -32,10 +33,18 @@ export class ChangedetailsPage implements OnInit { ...@@ -32,10 +33,18 @@ export class ChangedetailsPage implements OnInit {
private service: ServiceService private service: ServiceService
) { ) {
// Gets userdata // Gets userdata
this.service.get('params').then(val => { this.service.get('userData').then(val => {
this.userData = val; console.log(JSON.parse(val));
console.log(val); this.userData = JSON.parse(val);
console.log(this.userData);
}); });
// this.service.get('user').then(data => {
// if (data) {
// this.userData = JSON.parse(data);
// console.log(this.userData);
// }
// });
} }
ngOnInit() {} ngOnInit() {}
...@@ -54,18 +63,28 @@ export class ChangedetailsPage implements OnInit { ...@@ -54,18 +63,28 @@ export class ChangedetailsPage implements OnInit {
console.log(form.value); console.log(form.value);
if (form.valid) { if (form.valid) {
// Change Password // Change Password
if (form.value.currentPassword && form.value.password) {
if ( if (
form.value.password && form.value.password &&
form.value.password != form.value.confirmPassword form.value.password === form.value.confirmPassword
) { ) {
// this.register.updatePassword(form.value.password); // this.register.updateData(form.value, this.userData.uid);
this.register.updatePassword(
form.value.currentPassword,
form.value.password
);
console.log('Password Changed and profile updated'), form.value;
} else { } else {
alert('Password should match'); console.log('Password should match');
this.confPasswordErr = 'Password should match';
} }
} else {
// Calls update user data fn // this.register.updateData(form.value, this.userData);
// this.register.updateData(form.value, this.userData.uid); console.log('profile updated', form.value);
console.log('valid form values', form.value); }
// console.log('valid form values', form.value);
} else {
console.log(form);
} }
} }
} }
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: contain;
object-position: center; object-position: center;
} }
} }
......
...@@ -71,20 +71,20 @@ ...@@ -71,20 +71,20 @@
</ion-row> </ion-row>
</div> </div>
<hr /> <hr />
<ion-row> <ion-row (click)="goToPage('wishlist')">
<ion-col class="textLeft p0"> <ion-col class="textLeft p0">
<p>Wishlist</p> <p>Wishlist</p>
</ion-col> </ion-col>
<ion-col class="textRight p0" (click)="goToPage('wishlist')"> <ion-col class="textRight p0">
<h6>(0)</h6> <h6>(0)</h6>
</ion-col> </ion-col>
</ion-row> </ion-row>
<hr /> <hr />
<ion-row> <ion-row (click)="goToPage('address')">
<ion-col class="textLeft p0"> <ion-col class="textLeft p0">
<p>Address</p> <p>Address</p>
</ion-col> </ion-col>
<ion-col class="textRight p0" (click)="goToPage('address')"> <ion-col class="textRight p0">
<h6 *ngIf="addressService.addList"> <h6 *ngIf="addressService.addList">
({{addressService.addressList.length}}) ({{addressService.addressList.length}})
</h6> </h6>
...@@ -102,11 +102,11 @@ ...@@ -102,11 +102,11 @@
</ion-col> </ion-col>
</ion-row> </ion-row>
<hr /> --> <hr /> -->
<ion-row> <ion-row (click)="goToPage('myorder')">
<ion-col class="textLeft p0"> <ion-col class="textLeft p0">
<p>My Order</p> <p>My Order</p>
</ion-col> </ion-col>
<ion-col class="textRight p0" (click)="goToPage('myorder')"> <ion-col class="textRight p0">
<h6> <h6>
<ion-icon name="arrow-forward"></ion-icon> <ion-icon name="arrow-forward"></ion-icon>
</h6> </h6>
......
...@@ -41,6 +41,7 @@ export class ProfilePage implements OnInit { ...@@ -41,6 +41,7 @@ export class ProfilePage implements OnInit {
downloadURL; downloadURL;
constructor( constructor(
private route: ActivatedRoute,
private router: Router, private router: Router,
private storage: AngularFireStorage, private storage: AngularFireStorage,
private useService: UserService, private useService: UserService,
...@@ -56,11 +57,15 @@ export class ProfilePage implements OnInit { ...@@ -56,11 +57,15 @@ export class ProfilePage implements OnInit {
} }
}); });
// Listens to url
route.params.subscribe(val => {
// Get user Data
this.service.get('userData').then(data => { this.service.get('userData').then(data => {
if (data) { if (data) {
this.loggedUser = JSON.parse(data); this.loggedUser = JSON.parse(data);
} }
}); });
});
} }
goToPage(path, data = null) { goToPage(path, data = null) {
...@@ -69,6 +74,7 @@ export class ProfilePage implements OnInit { ...@@ -69,6 +74,7 @@ export class ProfilePage implements OnInit {
} }
ngOnInit() { ngOnInit() {
console.log('profile page');
const This = this; const This = this;
setTimeout(() => { setTimeout(() => {
this.user = this.useService.users; this.user = this.useService.users;
......
...@@ -9,15 +9,15 @@ ...@@ -9,15 +9,15 @@
</div> </div>
<ion-content> <ion-content>
<!-- <div class="wishlist-wrapper"> <div class="wishlist-wrapper">
<ul> <ul>
<li> <li>
<div class="wishlist_image"> <div class="wishlist_image">
<img src="../../assets/img-list.png"> <img src="../../assets/img-list.png" />
</div> </div>
<div class="wishlist_detail"> <div class="wishlist_detail">
<p class="floatLeft">European Style V Neck</p> <p class="floatLeft">European Style V Neck</p>
<span class="floatRight"><img src="../../assets/heart.png"></span> <span class="floatRight"><img src="../../assets/heart.png"/></span>
<div class="clear"></div> <div class="clear"></div>
<p>Green, Small</p> <p>Green, Small</p>
<h1>AU$88.00</h1> <h1>AU$88.00</h1>
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
</li> </li>
<li> <li>
<div class="wishlist_image"> <div class="wishlist_image">
<img src="../../assets/img-list.png"> <img src="../../assets/img-list.png" />
</div> </div>
<div class="wishlist_detail"> <div class="wishlist_detail">
<p class="floatLeft">European Style V Neck</p> <p class="floatLeft">European Style V Neck</p>
<span class="floatRight"><img src="../../assets/heart.png"></span> <span class="floatRight"><img src="../../assets/heart.png"/></span>
<div class="clear"></div> <div class="clear"></div>
<p>Green, Small</p> <p>Green, Small</p>
<h1>AU$88.00</h1> <h1>AU$88.00</h1>
...@@ -38,13 +38,13 @@ ...@@ -38,13 +38,13 @@
<div class="clear"></div> <div class="clear"></div>
</li> </li>
</ul> </ul>
</div> --> </div>
<!--
<div class="empty-wishlist-wrapper"> <div class="empty-wishlist-wrapper">
<img src="../../assets/wishlist.png" /> <img src="../../assets/wishlist.png" />
<h1>There is no products added</h1> <h1>There is no products added</h1>
<button (click)="goToPage('home')">shop now</button> <button (click)="goToPage('home')">shop now</button>
</div> </div> -->
<div class="footer-btns-wrapper"> <div class="footer-btns-wrapper">
<button class="btn-clear">Clear All</button> <button class="btn-clear">Clear All</button>
......
export interface Wishlist {
amount: string;
bookDate: any;
pickupLocation: any;
deliveryLocation: any;
deliveryAddress: any;
status: number;
orderStatus: number;
riderName: string;
orderId: string;
time: string;
product: any;
orderCode: string;
}
...@@ -21,6 +21,7 @@ export class UpdateService { ...@@ -21,6 +21,7 @@ export class UpdateService {
type: number; type: number;
userPostData: any; userPostData: any;
updateStatus: number; updateStatus: number;
loader: boolean;
constructor( constructor(
public afs: AngularFirestore, public afs: AngularFirestore,
...@@ -47,25 +48,88 @@ export class UpdateService { ...@@ -47,25 +48,88 @@ export class UpdateService {
// }); // });
} }
updateData(userData: UpdateUserDetails, uid: string) { // Update User Data
updateData(userData: UpdateUserDetails, oldData: User) {
this.loader = true;
this.type = 2; this.type = 2;
const postData: UpdateUserDetails = { const postData: UpdateUserDetails = {
phone: userData.phone, phone: userData.phone,
name: userData.name name: userData.name
}; };
const updateOldData = {
...oldData,
phone: userData.phone,
name: userData.name
};
this.userPostData = postData; this.userPostData = postData;
this.afs this.afs
.collection('customers') .collection('customers')
.doc(uid) .doc(oldData.uid)
.update(postData) .update(postData)
.then(() => { .then(() => {
console.log('success'); this.service
.set('userData', JSON.stringify(updateOldData))
.then(res => {
console.log('success', updateOldData, res);
this.service
.showToast('Profile updated!', 'top', 'my-toast', 1000)
.then(res => {
this.router.navigateByUrl('profile'); this.router.navigateByUrl('profile');
this.loader = false;
});
})
.catch(err => console.log(err));
}) })
.catch(error => { .catch(error => {
console.log(error); console.log(error);
}); });
} }
// Change user password
updatePassword(currentPassword: string, newPasswd: string) {
this.loader = true;
let currentUser = this.afAuth.auth.currentUser; // Gets current user
// Credential is required for re-authentication
const credential = auth.EmailAuthProvider.credential(
currentUser.email,
currentPassword
);
// Re-authenticate user
currentUser
.reauthenticateWithCredential(credential)
.then(() => {
currentUser
.updatePassword(newPasswd) // Update password
.then(success => {
console.log('password changed');
this.loader = false;
this.service
.showToast('Password Changed!', 'top', 'my-toast', 1000) //success toast
.then(res => {
this.router.navigateByUrl('profile');
this.loader = false;
});
})
.catch(error => {
console.log('something fishy');
this.service
.showToast('Something went wrong', 'top', 'my-toast', 1000) //failure toast
.then(res => {
this.loader = false;
});
});
})
.catch(error => {
console.log(error);
this.service
.showToast(error.message, 'top', 'my-error', 3000) //failure toast
.then(res => {
this.loader = false;
});
});
}
} }
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