Commit 2dd22418 by Adarsh K

Merge branch 'adarsh' into 'master'

Adarsh See merge request !47
parents 6883ff07 e6c872c6
<div class="nav_header"> <div class="nav_header">
<button class="nav_btn nav_back floatLeft" (click)="goBack()"> <button class="nav_btn nav_back floatLeft" (click)="goBack()">
<img src="../assets/Group17_2.png"> <img src="../assets/Group17_2.png" />
</button> </button>
<div class="nav_title floatLeft"> <div class="nav_title floatLeft">
<h4>Address</h4> <h4>Address</h4>
...@@ -9,35 +9,36 @@ ...@@ -9,35 +9,36 @@
</div> </div>
<ion-content> <ion-content>
<div class="address-wrapper"> <div class="address-wrapper" *ngIf="addressService.addressList">
<ion-grid> <ion-grid *ngFor="let address of addressService.addressList; let i = index">
<ion-row> <ion-row>
<ion-col size="1"> <ion-col size="1">
<input type="radio" class="address-radio" name="address" checked> <input
type="radio"
id="address_{{i}}"
class="address-radio"
name="address"
[checked]="address.defaultVal == 1"
/>
</ion-col> </ion-col>
<ion-col size="9"> <ion-col size="9">
<h1>Shamjith KS</h1> <h1>{{address.addressType}}</h1>
<h1>+00 0000 888 888</h1> <h1>{{address.address}}</h1>
<p>Carnival Infopark, Infopark Kochi 682030, Kerala, India</p> <p>{{address.building}}, {{address.landmark}}</p>
</ion-col> </ion-col>
<ion-col size="2"><button class="show-btn"><img src="../../assets/delete.png"></button></ion-col> <ion-col size="2" [hidden]="address.defaultVal == 1"
><button
class="show-btn"
(click)="addressService.deleteAddress(address.addressId)"
>
<img src="../../assets/delete.png" /></button
></ion-col>
</ion-row> </ion-row>
</ion-grid> </ion-grid>
<ion-grid> <div class="address-btn-wrapper">
<ion-row> <button class="show-btn" (click)="goToPage('nearby')">
<ion-col size="1"> Add New Address
<input type="radio" class="address-radio" name="address"> </button>
</ion-col> </div>
<ion-col size="9">
<h1>Shamjith KS</h1>
<h1>+00 0000 888 888</h1>
<p>Carnival Infopark, Infopark Kochi 682030, Kerala, India</p>
</ion-col>
<ion-col size="2"><button><img src="../../assets/delete.png"></button></ion-col>
</ion-row>
</ion-grid>
<div class="address-btn-wrapper"><button class="show-btn">Add New Address</button></div>
</div> </div>
</ion-content> </ion-content>
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { AddressService } from './../../config/address.service';
import { Router, ActivatedRoute } from '@angular/router';
import { Location } from '@angular/common';
@Component({ @Component({
selector: 'app-address', selector: 'app-address',
templateUrl: './address.page.html', templateUrl: './address.page.html',
styleUrls: ['./address.page.scss'], styleUrls: ['./address.page.scss']
}) })
export class AddressPage implements OnInit { export class AddressPage implements OnInit {
constructor(
private location: Location,
public addressService: AddressService,
public router: Router
) {}
constructor() { } ngOnInit() {}
ngOnInit() { goBack() {
this.location.back();
} }
goToPage(path, data = null) {
this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
} }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<ion-menu-toggle> <ion-menu-toggle>
<li (click)="vieworder('home')">Shop</li> <li (click)="vieworder('home')">Shop</li>
</ion-menu-toggle> </ion-menu-toggle>
<li>About us</li> <!-- <li>About us</li> -->
<ion-menu-toggle> <ion-menu-toggle>
<li (click)="vieworder('myorder')">View Order</li> <li (click)="vieworder('myorder')">View Order</li>
</ion-menu-toggle> </ion-menu-toggle>
...@@ -42,7 +42,9 @@ ...@@ -42,7 +42,9 @@
<li>Electronics</li> --> <li>Electronics</li> -->
</ul> </ul>
</div> </div>
<li>Complaints & Feedback</li> <ion-menu-toggle>
<li (click)="vieworder('feedback')">Complaints & Feedback</li>
</ion-menu-toggle>
<li> <li>
<span class="floatLeft" (click)="authService.SignOut()" <span class="floatLeft" (click)="authService.SignOut()"
>Logout</span >Logout</span
......
...@@ -6,6 +6,45 @@ ...@@ -6,6 +6,45 @@
} }
.side_menu_wrapper { .side_menu_wrapper {
background: rgba(41, 40, 91, 1);
width: 100%;
height: 100vh;
padding-left: 20px;
padding-top: 20px;
padding-right: 10px;
.top_banner {
.top_image {
width: 60px;
height: 60px;
float: left;
border-radius: 50%;
background-color: #fff;
img {
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
border-radius: 50%;
}
}
.top_detail {
width: calc(100% - 60px);
float: left;
padding: 7px;
padding-left: 15px;
h4 {
margin: 0px;
padding: 0px;
color: #fff;
}
p {
margin: 0px;
padding: 0px;
color: #fff;
color: rgba(176, 174, 199, 1);
}
}
}
} }
.sidemenu_list { .sidemenu_list {
padding-top: 30px; padding-top: 30px;
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common';
@Component({ @Component({
selector: 'app-feedback', selector: 'app-feedback',
templateUrl: './feedback.page.html', templateUrl: './feedback.page.html',
styleUrls: ['./feedback.page.scss'], styleUrls: ['./feedback.page.scss']
}) })
export class FeedbackPage implements OnInit { export class FeedbackPage implements OnInit {
constructor(private location: Location) {}
constructor() { } ngOnInit() {}
ngOnInit() { goBack() {
this.location.back();
} }
} }
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
</div> --> </div> -->
<div class="profile_circle"> <div class="profile_circle">
<img [src]="loggedUser.profilePhoto" onerror="this.src='./../../assets/profile_banner.png'" /> <img
[src]="loggedUser.profilePhoto"
onerror="this.src='./../../assets/profile_banner.png'"
/>
<div class="edit"></div> <div class="edit"></div>
<input type="file" accept="image/*" (change)="fileChange($event)" /> <input type="file" accept="image/*" (change)="fileChange($event)" />
</div> </div>
...@@ -26,8 +29,11 @@ ...@@ -26,8 +29,11 @@
<div class="account_wrapper"> <div class="account_wrapper">
<div class="account_header"> <div class="account_header">
<h5 class="floatLeft">ACCOUNT INFORMATION</h5> <h5 class="floatLeft">ACCOUNT INFORMATION</h5>
<span class="floatRight" (click)="goToPage('changedetails', user && user)"><img <span
src="../../assets/edit.png" /></span> class="floatRight"
(click)="goToPage('changedetails', user && user)"
><img src="../../assets/edit.png"
/></span>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="row"> <div class="row">
...@@ -36,7 +42,9 @@ ...@@ -36,7 +42,9 @@
<p> <p>
Phone Phone
<span *ngIf="loggedUser.phoneVerified == true">Verified</span> <span *ngIf="loggedUser.phoneVerified == true">Verified</span>
<span *ngIf="loggedUser.phoneVerified == false">Not Verified yet</span> <span *ngIf="loggedUser.phoneVerified == false"
>Not Verified yet</span
>
</p> </p>
</ion-col> </ion-col>
<ion-col class="textRight p0"> <ion-col class="textRight p0">
...@@ -48,8 +56,12 @@ ...@@ -48,8 +56,12 @@
<ion-row> <ion-row>
<ion-col class="textLeft p0"> <ion-col class="textLeft p0">
<p> <p>
Email<span *ngIf="userData && userData.emailVerified == true">Verified</span> Email<span *ngIf="userData && userData.emailVerified == true"
<span *ngIf="loggedUser.emailVerified == false">Not Verified yet</span> >Verified</span
>
<span *ngIf="loggedUser.emailVerified == false"
>Not Verified yet</span
>
</p> </p>
</ion-col> </ion-col>
<ion-col class="textRight p0"> <ion-col class="textRight p0">
...@@ -62,7 +74,7 @@ ...@@ -62,7 +74,7 @@
<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"> <ion-col class="textRight p0" (click)="goToPage('wishlist')">
<h6>(3)</h6> <h6>(3)</h6>
</ion-col> </ion-col>
</ion-row> </ion-row>
...@@ -71,22 +83,24 @@ ...@@ -71,22 +83,24 @@
<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"> <ion-col class="textRight p0" (click)="goToPage('address')">
<h6>(1)</h6> <h6 *ngIf="addressService.addList">
({{addressService.addressList.length}})
</h6>
</ion-col> </ion-col>
</ion-row> </ion-row>
<hr /> <hr />
<ion-row> <!-- <ion-row>
<ion-col class="textLeft p0"> <ion-col class="textLeft p0">
<p>My Cards</p> <p>My Cards</p>
</ion-col> </ion-col>
<ion-col class="textRight p0"> <ion-col class="textRight p0" (click)="goToPage('addcard')">
<h6> <h6>
<ion-icon name="arrow-forward"></ion-icon> <ion-icon name="arrow-forward"></ion-icon>
</h6> </h6>
</ion-col> </ion-col>
</ion-row> </ion-row>
<hr /> <hr /> -->
<ion-row> <ion-row>
<ion-col class="textLeft p0"> <ion-col class="textLeft p0">
<p>My Order</p> <p>My Order</p>
...@@ -115,10 +129,15 @@ ...@@ -115,10 +129,15 @@
<h4>Logout</h4> <h4>Logout</h4>
<p>Are you sure to Logout ?</p> <p>Are you sure to Logout ?</p>
<div class="logout_footer"> <div class="logout_footer">
<button class="btn-cancel floatLeft" (click)="istoggle();">
<button class="btn-cancel floatLeft" (click)="istoggle();">Cancel</button> Cancel
<button class="btn-logout floatRight" (click)="authService.SignOut(); istoggle()">Logout</button> </button>
<button
class="btn-logout floatRight"
(click)="authService.SignOut(); istoggle()"
>
Logout
</button>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
......
import { Component, OnInit } from "@angular/core"; import { Component, OnInit } from '@angular/core';
import { User } from "../../config/services/user"; import { User } from '../../config/services/user';
import { UserService } from "../../config/user.service"; import { UserService } from '../../config/user.service';
import { ServiceService } from "../../config/service.service"; import { ServiceService } from '../../config/service.service';
import { AuthService } from "../../config/auth.service"; import { AuthService } from '../../config/auth.service';
import { Router, ActivatedRoute } from "@angular/router"; import { Router, ActivatedRoute } from '@angular/router';
import { finalize, tap } from "rxjs/operators"; import { finalize, tap } from 'rxjs/operators';
import { Location } from '@angular/common';
import { AddressService } from './../../config/address.service';
import { import {
AngularFireStorage, AngularFireStorage,
AngularFireStorageReference, AngularFireStorageReference,
AngularFireUploadTask AngularFireUploadTask
} from "@angular/fire/storage"; } from '@angular/fire/storage';
import { trigger, transition, animate, style } from "@angular/animations"; import { trigger, transition, animate, style } from '@angular/animations';
@Component({ @Component({
selector: "app-profile", selector: 'app-profile',
templateUrl: "./profile.page.html", templateUrl: './profile.page.html',
styleUrls: ["./profile.page.scss"], styleUrls: ['./profile.page.scss'],
animations: [ animations: [
trigger("slideInOut", [ trigger('slideInOut', [
transition(":enter", [ transition(':enter', [
style({ transform: "translateY(100%)" }), style({ transform: 'translateY(100%)' }),
animate("200ms ease-in", style({ transform: "translateY(0%)" })) animate('200ms ease-in', style({ transform: 'translateY(0%)' }))
]), ]),
transition(":leave", [ transition(':leave', [
animate("200ms ease-out", style({ transform: "translateY(100%)" })) animate('200ms ease-out', style({ transform: 'translateY(100%)' }))
]) ])
]) ])
] ]
...@@ -43,16 +45,18 @@ export class ProfilePage implements OnInit { ...@@ -43,16 +45,18 @@ export class ProfilePage implements OnInit {
private storage: AngularFireStorage, private storage: AngularFireStorage,
private useService: UserService, private useService: UserService,
private service: ServiceService, private service: ServiceService,
private authService: AuthService private authService: AuthService,
private addressService: AddressService,
private location: Location
) { ) {
this.service.get("user").then(data => { this.service.get('user').then(data => {
if (data) { if (data) {
this.userData = JSON.parse(data); this.userData = JSON.parse(data);
console.log(this.userData); console.log(this.userData);
} }
}); });
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);
} }
...@@ -69,7 +73,7 @@ export class ProfilePage implements OnInit { ...@@ -69,7 +73,7 @@ export class ProfilePage implements OnInit {
setTimeout(() => { setTimeout(() => {
this.user = this.useService.users; this.user = this.useService.users;
// console.log('[users]', this.user); // console.log('[users]', this.user);
this.service.set("params", this.user); this.service.set('params', this.user);
}, 500); }, 500);
} }
...@@ -77,6 +81,10 @@ export class ProfilePage implements OnInit { ...@@ -77,6 +81,10 @@ export class ProfilePage implements OnInit {
this.isShow = !this.isShow; this.isShow = !this.isShow;
} }
goBack() {
this.location.back();
}
async fileChange(event) { async fileChange(event) {
const fileList: FileList = event.target.files; const fileList: FileList = event.target.files;
if (fileList.length > 0) { if (fileList.length > 0) {
...@@ -92,8 +100,8 @@ export class ProfilePage implements OnInit { ...@@ -92,8 +100,8 @@ export class ProfilePage implements OnInit {
reader.readAsDataURL(event.target.files[0]); reader.readAsDataURL(event.target.files[0]);
const file = fileList[0]; const file = fileList[0];
const ext = file.name.split(".").pop(); const ext = file.name.split('.').pop();
if (ext === "jpg" || ext === "jpeg" || ext === "png") { if (ext === 'jpg' || ext === 'jpeg' || ext === 'png') {
const path = file.name; // + Date.now(); const path = file.name; // + Date.now();
const ref = this.storage.ref(path); const ref = this.storage.ref(path);
const task = this.storage const task = this.storage
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common';
@Component({ @Component({
selector: 'app-wishlist', selector: 'app-wishlist',
templateUrl: './wishlist.page.html', templateUrl: './wishlist.page.html',
styleUrls: ['./wishlist.page.scss'], styleUrls: ['./wishlist.page.scss']
}) })
export class WishlistPage implements OnInit { export class WishlistPage implements OnInit {
constructor(private location: Location) {}
constructor() { } ngOnInit() {}
ngOnInit() { goBack() {
this.location.back();
} }
} }
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/firestore'; import {
AngularFirestore,
AngularFirestoreCollection
} from '@angular/fire/firestore';
import { take } from 'rxjs/operators'; import { take } from 'rxjs/operators';
import { Address, AddressList } from './services/address'; import { Address, AddressList } from './services/address';
...@@ -78,6 +81,12 @@ export class AddressService { ...@@ -78,6 +81,12 @@ export class AddressService {
console.log('Address updated Successfully'); console.log('Address updated Successfully');
}); });
}, 1000); }, 1000);
}
deleteAddress(addId: string) {
this.afs
.collection('address')
.doc(addId)
.delete();
} }
} }
...@@ -282,10 +282,3 @@ export class AuthService { ...@@ -282,10 +282,3 @@ export class AuthService {
return false; return false;
} }
} }
/*displayName: "Adarsh Techware"
email: "[email protected]"
emailVerified: true
: "https://lh4.googleusercontent.com/-h0rs2pE-Azw/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rcjNtapRhKoG09NKifQsv_lQPC_2A/photo.jpg"
: "vT498Fz6X0Z6l5l5iNn5hxfwz692"
providerData: [Gl]*/
import { Injectable } from "@angular/core"; import { Injectable } from '@angular/core';
import { import {
AngularFirestore, AngularFirestore,
AngularFirestoreDocument, AngularFirestoreDocument,
AngularFirestoreCollection AngularFirestoreCollection
} from "@angular/fire/firestore"; } from '@angular/fire/firestore';
import { Router, ActivatedRoute } from "@angular/router"; import { Router, ActivatedRoute } from '@angular/router';
import { Products } from "./services/product"; import { Products } from './services/product';
import { Cart, CartItem } from "./services/cart"; import { Cart, CartItem } from './services/cart';
import { ServiceService } from "./service.service"; import { ServiceService } from './service.service';
import * as firebase from "firebase"; import * as firebase from 'firebase';
import { take } from "rxjs/operators"; import { take } from 'rxjs/operators';
import { User } from "./services/user"; import { User } from './services/user';
import { from } from "rxjs"; import { from } from 'rxjs';
@Injectable({ @Injectable({
providedIn: "root" providedIn: 'root'
}) })
export class CartsService { export class CartsService {
size: string; size: string;
...@@ -31,9 +31,9 @@ export class CartsService { ...@@ -31,9 +31,9 @@ export class CartsService {
public router: Router, public router: Router,
public service: ServiceService public service: ServiceService
) { ) {
this.custId = ""; this.custId = '';
this.carts = []; this.carts = [];
const users = this.service.get("user").then(data => { const users = this.service.get('user').then(data => {
if (data) { if (data) {
data = JSON.parse(data); data = JSON.parse(data);
this.custId = data.uid; this.custId = data.uid;
...@@ -46,20 +46,20 @@ export class CartsService { ...@@ -46,20 +46,20 @@ export class CartsService {
this.prodId = product.prodId; this.prodId = product.prodId;
const prodRef = firebase const prodRef = firebase
.firestore() .firestore()
.collection("products") .collection('products')
.doc(this.prodId); .doc(this.prodId);
this.size = this.size === undefined ? product.size[0] : this.size; this.size = this.size === undefined ? product.size[0] : this.size;
this.color = this.color === undefined ? product.color[0] : this.color; this.color = this.color === undefined ? product.color[0] : this.color;
const cartRef: AngularFirestoreCollection<any> = this.afs.collection( const cartRef: AngularFirestoreCollection<any> = this.afs.collection(
"carts", 'carts',
ref => ref =>
ref ref
.where("size", "==", this.size) .where('size', '==', this.size)
.where("color", "==", this.color) .where('color', '==', this.color)
.where("custId", "==", this.custId) .where('custId', '==', this.custId)
.where("product", "==", prodRef) .where('product', '==', prodRef)
); );
cartRef cartRef
.valueChanges() .valueChanges()
...@@ -69,7 +69,7 @@ export class CartsService { ...@@ -69,7 +69,7 @@ export class CartsService {
if (value.length === 0) { if (value.length === 0) {
product.image = product.image =
product.image === undefined product.image === undefined
? "../assets/[email protected]" ? '../assets/[email protected]'
: product.image; : product.image;
const cart: Cart = { const cart: Cart = {
color: this.color, color: this.color,
...@@ -86,12 +86,12 @@ export class CartsService { ...@@ -86,12 +86,12 @@ export class CartsService {
}; };
// console.log(cart); // console.log(cart);
this.afs this.afs
.collection("carts") .collection('carts')
.add(cart) .add(cart)
.then(docRef => { .then(docRef => {
const neworderId = docRef.id; const neworderId = docRef.id;
this.afs this.afs
.collection("carts") .collection('carts')
.doc(neworderId) .doc(neworderId)
.update({ cartId: docRef.id }) .update({ cartId: docRef.id })
.then(() => { .then(() => {
...@@ -100,7 +100,7 @@ export class CartsService { ...@@ -100,7 +100,7 @@ export class CartsService {
}); });
}) })
.catch(error => { .catch(error => {
console.error("Error adding document: ", error); console.error('Error adding document: ', error);
}); });
} else { } else {
// console.log(value); // console.log(value);
...@@ -109,7 +109,7 @@ export class CartsService { ...@@ -109,7 +109,7 @@ export class CartsService {
// tslint:disable-next-line:radix // tslint:disable-next-line:radix
const qty = parseInt(value[0].qty) + 1; const qty = parseInt(value[0].qty) + 1;
this.afs this.afs
.collection("carts") .collection('carts')
.doc(cartId) .doc(cartId)
.update({ qty: `${qty}` }) .update({ qty: `${qty}` })
.then(() => { .then(() => {
...@@ -122,8 +122,8 @@ export class CartsService { ...@@ -122,8 +122,8 @@ export class CartsService {
public async cartList() { public async cartList() {
const cartRef: AngularFirestoreCollection<any> = this.afs.collection( const cartRef: AngularFirestoreCollection<any> = this.afs.collection(
"carts", 'carts',
ref => ref.where("custId", "==", this.custId) ref => ref.where('custId', '==', this.custId)
); );
cartRef.valueChanges().subscribe(value => { cartRef.valueChanges().subscribe(value => {
this.carts = []; this.carts = [];
...@@ -181,7 +181,7 @@ export class CartsService { ...@@ -181,7 +181,7 @@ export class CartsService {
this.carts[index].qty = qty; this.carts[index].qty = qty;
// console.log(this.carts[index].qty); // console.log(this.carts[index].qty);
this.afs this.afs
.collection("carts") .collection('carts')
.doc(this.carts[index].cartId) .doc(this.carts[index].cartId)
.update({ .update({
qty: this.carts[index].qty qty: this.carts[index].qty
...@@ -193,7 +193,7 @@ export class CartsService { ...@@ -193,7 +193,7 @@ export class CartsService {
this.cartTotal = 0; this.cartTotal = 0;
this.carts[index].qty = qty; this.carts[index].qty = qty;
this.afs this.afs
.collection("carts") .collection('carts')
.doc(this.carts[index].cartId) .doc(this.carts[index].cartId)
.update({ .update({
qty: this.carts[index].qty qty: this.carts[index].qty
...@@ -202,7 +202,7 @@ export class CartsService { ...@@ -202,7 +202,7 @@ export class CartsService {
removeItem(index) { removeItem(index) {
this.afs this.afs
.collection("carts") .collection('carts')
.doc(this.carts[index].cartId) .doc(this.carts[index].cartId)
.delete(); .delete();
} }
...@@ -211,9 +211,9 @@ export class CartsService { ...@@ -211,9 +211,9 @@ export class CartsService {
// console.log(promoCode); // console.log(promoCode);
const state = true; const state = true;
const promoRef: AngularFirestoreCollection<any> = this.afs.collection( const promoRef: AngularFirestoreCollection<any> = this.afs.collection(
"promocode", 'promocode',
ref => ref =>
ref.where("promoCode", "==", promoCode).where("status", "==", state) ref.where('promoCode', '==', promoCode).where('status', '==', state)
); );
return promoRef.valueChanges(); return promoRef.valueChanges();
} }
......
import { Injectable } from "@angular/core"; import { Injectable } from '@angular/core';
import { import {
AngularFirestore, AngularFirestore,
AngularFirestoreDocument, AngularFirestoreDocument,
AngularFirestoreCollection AngularFirestoreCollection
} from "@angular/fire/firestore"; } from '@angular/fire/firestore';
import { Category } from "./services/category"; import { Category } from './services/category';
import * as firebase from "firebase"; import * as firebase from 'firebase';
import { ServiceService } from "./service.service"; import { ServiceService } from './service.service';
@Injectable({ @Injectable({
providedIn: "root" providedIn: 'root'
}) })
export class CategoriesService { export class CategoriesService {
categories: Category[] = []; categories: Category[] = [];
...@@ -22,7 +22,7 @@ export class CategoriesService { ...@@ -22,7 +22,7 @@ export class CategoriesService {
public async categoryList() { public async categoryList() {
const This = this; const This = this;
const orderRef: AngularFirestoreCollection<any> = this.afs.collection( const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"shopcategory" 'shopcategory'
); );
orderRef.valueChanges().subscribe(value => { orderRef.valueChanges().subscribe(value => {
this.categories = []; this.categories = [];
...@@ -50,8 +50,8 @@ export class CategoriesService { ...@@ -50,8 +50,8 @@ export class CategoriesService {
const This = this; const This = this;
const state = true; const state = true;
const orderRef: AngularFirestoreCollection<any> = this.afs.collection( const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"shopcategory", 'shopcategory',
ref => ref.where("status", "==", state) ref => ref.where('status', '==', state)
); );
orderRef.valueChanges().subscribe(value => { orderRef.valueChanges().subscribe(value => {
this.activecategories = []; this.activecategories = [];
......
import { Injectable } from "@angular/core"; import { Injectable } from '@angular/core';
import { import {
AngularFirestore, AngularFirestore,
AngularFirestoreDocument, AngularFirestoreDocument,
AngularFirestoreCollection AngularFirestoreCollection
} from "@angular/fire/firestore"; } from '@angular/fire/firestore';
import { Myorder } from "./services/myorder"; import { Myorder } from './services/myorder';
import { ServiceService } from "./../config/service.service"; import { ServiceService } from './../config/service.service';
import * as firebase from "firebase"; import * as firebase from 'firebase';
import { take } from "rxjs/operators"; import { take } from 'rxjs/operators';
import { Observable, of } from "rxjs"; import { Observable, of } from 'rxjs';
@Injectable({ @Injectable({
providedIn: "root" providedIn: 'root'
}) })
export class MyordersService { export class MyordersService {
product: Myorder[] = []; product: Myorder[] = [];
...@@ -20,7 +20,7 @@ export class MyordersService { ...@@ -20,7 +20,7 @@ export class MyordersService {
selItem: Myorder; selItem: Myorder;
constructor(public afs: AngularFirestore, public service: ServiceService) { constructor(public afs: AngularFirestore, public service: ServiceService) {
const users = this.service.get("user").then(data => { const users = this.service.get('user').then(data => {
if (data) { if (data) {
data = JSON.parse(data); data = JSON.parse(data);
this.custId = data.uid; this.custId = data.uid;
...@@ -29,7 +29,7 @@ export class MyordersService { ...@@ -29,7 +29,7 @@ export class MyordersService {
// this.orderState(); // this.orderState();
} }
} else { } else {
this.custId = "WwHnLICVY2dvZGUHuKqasiTB91a2"; this.custId = 'WwHnLICVY2dvZGUHuKqasiTB91a2';
} }
}); });
} }
...@@ -85,8 +85,8 @@ export class MyordersService { ...@@ -85,8 +85,8 @@ export class MyordersService {
const This = this; const This = this;
this.orders = []; this.orders = [];
const orderRef: AngularFirestoreCollection<any> = this.afs.collection( const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"orders", 'orders',
ref => ref.where("custId", "==", custId).orderBy("bookDate", "desc") ref => ref.where('custId', '==', custId).orderBy('bookDate', 'desc')
); );
orderRef.stateChanges().subscribe(value => { orderRef.stateChanges().subscribe(value => {
// console.log(value); // console.log(value);
...@@ -105,14 +105,14 @@ export class MyordersService { ...@@ -105,14 +105,14 @@ export class MyordersService {
deliveryLocation: item.deliveryLocation, deliveryLocation: item.deliveryLocation,
pickupLocation: item.pickupLocation, pickupLocation: item.pickupLocation,
deliveryAddress: item.deliveryAddress, deliveryAddress: item.deliveryAddress,
riderName: "John", riderName: 'John',
orderId: item.orderId, orderId: item.orderId,
orderCode: item.orderCode, orderCode: item.orderCode,
product: this.service.key2Array(item.product), product: this.service.key2Array(item.product),
time: "60" time: '60'
}; };
// console.log(order); // console.log(order);
if (items.type === "added") { if (items.type === 'added') {
this.orders.push(order); this.orders.push(order);
} else { } else {
// console.log(orderId); // console.log(orderId);
......
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { import { User, UpdateUserDetails, Address } from './services/user';
User,
UpdateUserDetails,
Address,
UpdatePassword
} from './services/user';
import { auth } from 'firebase/app'; import { auth } from 'firebase/app';
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
import { AngularFireAuth } from '@angular/fire/auth'; import { AngularFireAuth } from '@angular/fire/auth';
...@@ -73,21 +68,4 @@ export class UpdateService { ...@@ -73,21 +68,4 @@ export class UpdateService {
console.log(error); console.log(error);
}); });
} }
// Change Password
updatePassword(userData: UpdatePassword) {
// Gets current user
let user = this.afAuth.auth.currentUser;
let newPassword = userData.password;
// Update password
user
.updatePassword(newPassword)
.then(() => {
console.log('Password Changed');
})
.catch(err => {
console.log(err);
});
}
} }
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