Commit 2dd22418 by Adarsh K

Merge branch 'adarsh' into 'master'

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