Commit aa11ddb9 by Arjun

bug

parents 1292d2ba b35f2269
...@@ -102,4 +102,4 @@ ...@@ -102,4 +102,4 @@
"android" "android"
] ]
} }
} }
\ No newline at end of file
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<div class="icon_sec m5_icon" [class.m5_icon_act]="sec_active5" (click)="setActive5()"></div> <div class="icon_sec m5_icon" [class.m5_icon_act]="sec_active5" (click)="setActive5()"></div>
</li> </li>
<li (click)="goToPage('profile')"> <li (click)="goToPage('profile')">
<div class="icon_sec m6_icon" [class.m6_icon_act]="sec_active6" (click)="setActive6()"></div> <div class="icon_sec m6_icon" [class.m6_icon_act]="sec_active6" (click)="setActive6()" menuClose></div>
</li> </li>
</ul> </ul>
</div> </div>
\ No newline at end of file
...@@ -3,7 +3,11 @@ import { Router, ActivatedRoute } from '@angular/router'; ...@@ -3,7 +3,11 @@ import { Router, ActivatedRoute } from '@angular/router';
import { Platform, Events } from '@ionic/angular'; import { Platform, Events } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx'; import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx'; import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AngularFirestore, AngularFirestoreDocument, AngularFirestoreCollection } from '@angular/fire/firestore'; import {
AngularFirestore,
AngularFirestoreDocument,
AngularFirestoreCollection
} from '@angular/fire/firestore';
import * as firebase from 'firebase'; import * as firebase from 'firebase';
import { ModalController } from '@ionic/angular'; import { ModalController } from '@ionic/angular';
import { DeliverypopPage } from './deliverypop/deliverypop.page'; import { DeliverypopPage } from './deliverypop/deliverypop.page';
...@@ -13,8 +17,6 @@ import { SubjectService } from './../config/subject.service'; ...@@ -13,8 +17,6 @@ import { SubjectService } from './../config/subject.service';
import { CategoriesService } from './../config/category.service'; import { CategoriesService } from './../config/category.service';
import { SearchmodalPage } from './searchmodal/searchmodal.page'; import { SearchmodalPage } from './searchmodal/searchmodal.page';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
templateUrl: 'app.component.html', templateUrl: 'app.component.html',
...@@ -30,6 +32,7 @@ export class AppComponent { ...@@ -30,6 +32,7 @@ export class AppComponent {
state: boolean; state: boolean;
menuw: number; menuw: number;
userData: any;
constructor( constructor(
private platform: Platform, private platform: Platform,
...@@ -46,10 +49,19 @@ export class AppComponent { ...@@ -46,10 +49,19 @@ export class AppComponent {
) { ) {
this.state = true; this.state = true;
this.initializeApp(); this.initializeApp();
this.orderState();
this.subjectService.getLoginData().subscribe(loginData => { this.subjectService.getLoginData().subscribe(loginData => {
this.state = loginData; this.state = loginData;
}); });
this.service.get('userData').then(userData => {
if (userData) {
this.userData = JSON.parse(userData);
console.log(userData);
this.orderState();
} else {
console.log(userData);
}
});
} }
initializeApp() { initializeApp() {
...@@ -70,7 +82,13 @@ export class AppComponent { ...@@ -70,7 +82,13 @@ export class AppComponent {
} }
fetchCase() { fetchCase() {
const restrictedUrl = ['productdetail', 'cart', 'nearby', 'verification']; const restrictedUrl = [
'productdetail',
'cart',
'nearby',
'verification',
'orderplaced'
];
const currentUrl = this.router.url.split('/'); const currentUrl = this.router.url.split('/');
const index = restrictedUrl.findIndex(x => x === currentUrl[1]); const index = restrictedUrl.findIndex(x => x === currentUrl[1]);
// console.log(currentUrl[1], index, this.state); // console.log(currentUrl[1], index, this.state);
...@@ -137,8 +155,7 @@ export class AppComponent { ...@@ -137,8 +155,7 @@ export class AppComponent {
} }
orderState() { orderState() {
console.log('called'); const custId = this.userData.uid;
const custId = 'WwHnLICVY2dvZGUHuKqasiTB91a2';
firebase firebase
.firestore() .firestore()
.collection('orders') .collection('orders')
......
...@@ -16,6 +16,7 @@ import { AngularFireModule } from '@angular/fire'; ...@@ -16,6 +16,7 @@ import { AngularFireModule } from '@angular/fire';
import { AngularFirestore } from '@angular/fire/firestore'; import { AngularFirestore } from '@angular/fire/firestore';
import { AngularFirestoreModule } from '@angular/fire/firestore'; import { AngularFirestoreModule } from '@angular/fire/firestore';
import { AngularFireAuthModule } from '@angular/fire/auth'; import { AngularFireAuthModule } from '@angular/fire/auth';
import { AngularFireStorageModule } from '@angular/fire/storage';
import { Geolocation } from '@ionic-native/geolocation/ngx'; import { Geolocation } from '@ionic-native/geolocation/ngx';
import { NativeGeocoder } from '@ionic-native/native-geocoder/ngx'; import { NativeGeocoder } from '@ionic-native/native-geocoder/ngx';
...@@ -41,6 +42,7 @@ import { SearchmodalPageModule } from './searchmodal/searchmodal.module'; ...@@ -41,6 +42,7 @@ import { SearchmodalPageModule } from './searchmodal/searchmodal.module';
DeliverypopPageModule, DeliverypopPageModule,
AngularFireAuthModule, AngularFireAuthModule,
AngularFirestoreModule, AngularFirestoreModule,
AngularFireStorageModule,
SearchmodalPageModule, SearchmodalPageModule,
FormsModule FormsModule
], ],
......
<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()"></button>
</button> <div class="nav_title floatLeft">
<div class="nav_title floatLeft"> <h4>MY ORDERS</h4>
<h4>MY ORDERS</h4> </div>
</div> <div class="clear"></div>
<div class="clear"></div>
</div> </div>
<ion-content> <ion-content>
<div class="myorder_wrapper" *ngIf="myorder.orders"> <div class="myorder_wrapper" *ngIf="myorder.orders">
<ul *ngIf="myorder.orders.length > 0"> <ul *ngIf="myorder.orders.length > 0">
<li *ngFor="let order of myorder.orders; let i = index"> <li *ngFor="let order of myorder.orders; let i = index">
<div class="order_info"> <div class="order_info">
<h5 class="floatLeft">{{order.orderCode}}</h5> <h5 class="floatLeft">{{order.orderCode}}</h5>
<button class="order_track floatRight" *ngIf="order.orderStatus >= 3 && order.orderStatus < 7" (click)="orderDetails(i)">Track Order</button> <button
<div class="clear"></div> class="order_track floatRight"
</div> *ngIf="order.orderStatus >= 3 && order.orderStatus < 7"
<div *ngFor="let product of order.product" (click)="viewOrder(order)"> (click)="orderDetails(i)"
<div class="order_image"><img [src]="product.image" onerror="" /></div> >
<div class="order_detail"> Track Order
<h5 class="floatLeft">{{product.prodName}}</h5> </button>
<div class="clear"></div> <div class="clear"></div>
<h5>{{product.color}}, {{product.size}} <span>{{product.qty}}</span></h5> </div>
<div *ngFor="let product of order.product" (click)="viewOrder(order)">
<p>A$ {{product.price}}</p> <div class="order_image">
<img [src]="product.image" onerror="" />
</div> </div>
<div class="order_other"> <div class="order_detail">
<h6 class="floatRight">{{ order.bookDate.seconds * 1000 | date:'MMMM dd, y' }}</h6> <h5 class="floatLeft">{{product.prodName}}</h5>
<span class="floatRight" *ngIf="order.orderStatus < 3 || order.orderStatus >= 7" (click)="acceptOrder(order)">{{getStatus(order.orderStatus)}}</span> <div class="clear"></div>
<div class="clear"></div> <h5>
<!-- <button class="track_btn" *ngIf="order.orderStatus >= 3 && order.orderStatus < 7" (click)="orderDetails(i)">TRACK</button> --> <span *ngIf="product.color !== 'No-Color'"
<div class="clear"></div> >{{product.color}},
</div> </span>
<div class="clear"></div> <span *ngIf="product.size !== 'Any-Size'">{{product.size}}</span
<hr> >&nbsp;<span>{{product.qty}}</span>
</div> </h5>
<p>A$ {{product.price}}</p>
</div>
<div class="order_info"> <div class="order_other">
<h5 class="floatRight">TOTAL PRICE : {{order.amount}}</h5> <h6 class="floatRight">
{{ order.bookDate.seconds * 1000 | date:'MMMM dd, y' }}
<div class="clear"></div> </h6>
</div> <span
</li> class="floatRight"
*ngIf="order.orderStatus < 3 || order.orderStatus >= 7"
<!-- <li> (click)="acceptOrder(order)"
>{{getStatus(order.orderStatus)}}</span
>
<div class="clear"></div>
<!-- <button class="track_btn" *ngIf="order.orderStatus >= 3 && order.orderStatus < 7" (click)="orderDetails(i)">TRACK</button> -->
<div class="clear"></div>
</div>
<div class="clear"></div>
<hr />
</div>
<div class="order_info">
<h5 class="floatRight">TOTAL PRICE : {{order.amount}}</h5>
<div class="clear"></div>
</div>
</li>
<!-- <li>
<div class="order_image"></div> <div class="order_image"></div>
<div class="order_detail"> <div class="order_detail">
<h5 class="floatLeft">European Style V Neck</h5> <h5 class="floatLeft">European Style V Neck</h5>
...@@ -91,12 +108,12 @@ ...@@ -91,12 +108,12 @@
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</li> --> </li> -->
</ul> </ul>
</div> </div>
</ion-content> </ion-content>
<div class="loader" *ngIf="loader"> <div class="loader" *ngIf="loader">
<div class="lds-ripple"> <div class="lds-ripple">
<div></div> <div></div>
<div></div> <div></div>
</div> </div>
</div> </div>
\ No newline at end of file
<ion-content> <ion-content>
<div class="cart_wrapper" *ngIf="data"> <div class="cart_wrapper" *ngIf="data">
<div class="cart_head"> <div class="cart_head">
<div class="nav_header"> <div class="nav_header">
<button class="nav_btn nav_back_white floatLeft" (click)="goBack()"> <button class="nav_btn nav_back_white floatLeft" (click)="goBack()">
<img src="../assets/arrow_white.png"> <img src="../assets/arrow_white.png" />
</button> </button>
<div class="nav_title floatLeft"> <div class="nav_title floatLeft">
<h4></h4> <h4></h4>
</div>
<button class="nav_btn floatRight">
</button>
<div class="clear"></div>
</div>
<img src="../assets/white_tick.png">
<h4>ORDER IS PLACED</h4>
<p>{{ data.bookDate.seconds * 1000 | date:'MMMM dd, y' }}</p>
</div> </div>
<div class="order_status"> <button class="nav_btn floatRight"></button>
<div class="clear"></div>
<div class="clear"></div> </div>
<div class="status_div go_green"> <img src="../assets/white_tick.png" />
<h4>Order Placed</h4> <h4>ORDER IS PLACED</h4>
<h6>{{ data.bookDate.seconds * 1000 | date:'MMMM dd, y' }}</h6> <p>{{ data.bookDate.seconds * 1000 | date:'MMMM dd, y' }}</p>
</div> </div>
<!-- <div class="status_gap go_green"> <div class="order_status">
<div class="clear"></div>
<div class="status_div go_green">
<h4>Order Placed</h4>
<h6>{{ data.bookDate.seconds * 1000 | date:'MMMM dd, y' }}</h6>
</div>
<!-- <div class="status_gap go_green">
</div> </div>
<div class="status_div go_green"> <div class="status_div go_green">
<h4>Retailer Accepted</h4> <h4>Retailer Accepted</h4>
...@@ -56,41 +54,56 @@ ...@@ -56,41 +54,56 @@
<div class="status_div"> <div class="status_div">
<h4>Your product is delivered</h4> <h4>Your product is delivered</h4>
</div> --> </div> -->
</div> </div>
<div class="nearby_shop_list"> <div class="nearby_shop_list">
<ul> <ul>
<li (click)="goToPage('productlist')"> <li (click)="goToPage('productlist')">
<div class="nearby_image"> <div class="nearby_image">
<img src="../assets/[email protected]"> <img
</div> [src]="data.product[0].image"
<div class="nearby_detail"> onerror="this.src='../assets/[email protected]'"
<h5> />
<span class="floatLeft">{{data.shopperName}}</span> </div>
<span class="floatRight">0 <div class="nearby_detail">
<img src="../assets/Path61_2.png">
</span>
<div class="clear"></div>
</h5>
<p>Men's & Women's Fashion</p>
</div>
<div class="clear"></div>
</li>
</ul>
</div>
<div class="product_detail" *ngFor="let product of data.product">
<h6>{{product.color}}, {{product.size}}</h6>
<h5>Quantity : <span>{{product.qty}}</span></h5>
<h5>Amount : <strong>A$ {{product.price}}</strong><span class="afterpay">COD</span></h5>
<h5>Delivery time : <span>Delivery in 1 hour</span></h5>
<h4>DELIVERY</h4>
<h5> <h5>
{{deliveryAddress}} <span class="floatLeft">{{data.shopperName}}</span>
<span class="floatRight"
>{{data.product[0].qty}}
<img src="../assets/Path61_2.png" />
</span>
<div class="clear"></div>
</h5> </h5>
<button class="cancel_btn" (click)="goToPage('ordercancelled')">CANCEL THIS ORDER</button> <p class="prodName">{{data.product[0].prodName}}</p>
<hr> </div>
</div> <div class="clear"></div>
</li>
</ul>
</div>
<div class="product_detail" *ngFor="let product of data.product">
<h6>
<span *ngIf="product.color !== 'No-Color'">{{product.color}}, </span>
<span *ngIf="product.size !== 'Any-Size'">{{product.size}}</span>
</h6>
<h5>Quantity : <span>{{product.qty}}</span></h5>
<h5>
Amount : <strong>A$ {{product.price}}</strong
><span class="afterpay">COD</span>
</h5>
<h5>Delivery time : <span>{{deliveryTime}}</span></h5>
<h4>DELIVERY</h4>
<h5 *ngIf="data.deliveryAddress">
{{data.deliveryAddress.addressType}},<br />{{data.deliveryAddress.address}},
<br />
{{data.deliveryAddress.building}}, <br />
{{data.deliveryAddress.landmark}}
</h5>
<button class="cancel_btn" (click)="goToPage('ordercancelled')">
CANCEL THIS ORDER
</button>
<hr />
</div>
<!-- <div class="related_product_slider"> <!-- <div class="related_product_slider">
<h5> <h5>
<span class="floatLeft">Related Products</span><span class="floatRight">MORE</span> <span class="floatLeft">Related Products</span><span class="floatRight">MORE</span>
<div class="clear"></div> <div class="clear"></div>
...@@ -145,5 +158,5 @@ ...@@ -145,5 +158,5 @@
</ion-slides> </ion-slides>
</ul> </ul>
</div> --> </div> -->
</div> </div>
</ion-content> </ion-content>
\ No newline at end of file
.cart_wrapper { .cart_wrapper {
width: 100%;
.cart_head {
width: 100%; width: 100%;
.cart_head { height: 240px;
width: 100%; text-align: center;
height: 240px; background-image: url('../../assets/[email protected]');
text-align: center; background-position: center bottom;
background-image: url("../../assets/[email protected]"); background-repeat: no-repeat;
background-position: center bottom; background-size: cover;
background-repeat: no-repeat; .nav_header {
background-size: cover; position: static;
.nav_header { background-color: transparent;
position: static; .nav_title {
background-color: transparent;
.nav_title {
h4 {
color: #FFF;
}
}
}
img {
width: 70px;
}
h4 { h4 {
color: #fff; color: #fff;
font-weight: bolder;
margin-bottom: 5px;
text-align: center;
}
p {
color: rgba(215, 213, 228, 1);
margin: 0px;
padding: 0px;
font-size: 14px;
text-align: center;
} }
}
} }
.order_status { img {
width: 100%; width: 70px;
padding: 20px;
.track_btn {
border-radius: 5px;
height: 40px;
background-color: #29285b;
color: #FFF;
font-size: 18px;
font-weight: lighter;
padding-left: 20px;
padding-right: 20px;
}
.status_div {
margin-bottom: 10px;
margin-top: 10px;
h4 {
margin: 0px;
padding: 0px;
color: rgba(215, 213, 228, 1);
}
h6 {
margin: 0px;
padding: 0px;
color: rgba(215, 213, 228, 1);
}
}
.go_green {
h4 {
color: rgba(53, 203, 171, 1);
}
}
.go_green.status_gap {
border-left: 2px dashed rgba(53, 203, 171, 1);
}
.status_gap {
border-left: 2px dashed rgba(215, 213, 228, 1);
height: 30px;
}
} }
.nearby_shop_list { h4 {
ul { color: #fff;
margin: 0px; font-weight: bolder;
padding-left: 10px; margin-bottom: 5px;
padding-right: 10px; text-align: center;
li {
list-style: none;
padding-bottom: 10px;
.nearby_image {
width: 120px;
height: 120px;
float: left;
background-color: #a8a8a8;
border-radius: 8px;
img {
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
}
}
.nearby_detail {
width: calc(100% - 120px);
float: left;
padding-left: 20px;
padding-top: 40px;
h5 {
margin: 0px;
padding: 0px;
color: rgba(59, 57, 77, 1);
font-weight: 900;
padding-bottom: 2px;
img {
width: 16px;
}
}
p {
margin: 0px;
padding: 0px;
color: rgba(176, 174, 199);
}
}
}
}
} }
.product_detail { p {
padding: 10px; color: rgba(215, 213, 228, 1);
hr { margin: 0px;
border-bottom: 1px solid rgba(176, 174, 199); padding: 0px;
height: 0px; font-size: 14px;
border-top: none; text-align: center;
} }
h6 { }
margin: 0px; .order_status {
padding: 0px; width: 100%;
color: #29285b; padding: 20px;
font-size: 18px; .track_btn {
padding-bottom: 15px; border-radius: 5px;
height: 40px;
background-color: #29285b;
color: #fff;
font-size: 18px;
font-weight: lighter;
padding-left: 20px;
padding-right: 20px;
}
.status_div {
margin-bottom: 10px;
margin-top: 10px;
h4 {
margin: 0px;
padding: 0px;
color: rgba(215, 213, 228, 1);
}
h6 {
margin: 0px;
padding: 0px;
color: rgba(215, 213, 228, 1);
}
}
.go_green {
h4 {
color: rgba(53, 203, 171, 1);
}
}
.go_green.status_gap {
border-left: 2px dashed rgba(53, 203, 171, 1);
}
.status_gap {
border-left: 2px dashed rgba(215, 213, 228, 1);
height: 30px;
}
}
.nearby_shop_list {
ul {
margin: 0px;
padding-left: 10px;
padding-right: 10px;
li {
list-style: none;
padding-bottom: 10px;
.nearby_image {
width: 120px;
height: 120px;
float: left;
background-color: #a8a8a8;
border-radius: 8px;
img {
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
}
} }
h5 { .nearby_detail {
width: calc(100% - 120px);
float: left;
padding-left: 20px;
padding-top: 40px;
h5 {
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
color: rgba(176, 174, 199, 1); color: rgba(59, 57, 77, 1);
font-size: 18px; font-weight: 900;
line-height: 25px; padding-bottom: 2px;
padding-bottom: 15px; img {
strong { width: 16px;
color: rgba(41, 40, 91, 1);
}
span {
color: rgba(41, 40, 91, 1);
}
.afterpay {
color: rgba(206, 153, 76, 1);
padding-left: 10px;
} }
} }
h4 { p {
color: rgba(41, 40, 91, 1);
margin: 0px; margin: 0px;
font-weight: 900; padding: 0px;
font-size: 18px; color: rgba(176, 174, 199);
padding-top: 20px; }
padding-bottom: 10px;
} }
.cancel_btn { }
border-radius: 8px; }
height: 45px; }
.product_detail {
padding: 10px;
hr {
border-bottom: 1px solid rgba(176, 174, 199);
height: 0px;
border-top: none;
}
h6 {
margin: 0px;
padding: 0px;
color: #29285b;
font-size: 18px;
padding-bottom: 15px;
}
h5 {
margin: 0px;
padding: 0px;
color: rgba(176, 174, 199, 1);
font-size: 18px;
line-height: 25px;
padding-bottom: 15px;
strong {
color: rgba(41, 40, 91, 1);
}
span {
color: rgba(41, 40, 91, 1);
}
.afterpay {
color: rgba(206, 153, 76, 1);
padding-left: 10px;
}
}
h4 {
color: rgba(41, 40, 91, 1);
margin: 0px;
font-weight: 900;
font-size: 18px;
padding-top: 20px;
padding-bottom: 10px;
}
.cancel_btn {
border-radius: 8px;
height: 45px;
width: 100%;
background-color: #29285b;
color: #fff;
font-size: 18px;
font-weight: lighter;
padding-left: 20px;
padding-right: 20px;
margin-bottom: 20px;
margin-top: 20px;
}
}
.related_product_slider {
h5 {
color: rgba(41, 40, 91, 1);
margin: 0px;
padding: 10px;
font-weight: 900;
font-size: 18px;
}
p {
color: rgba(59, 57, 77, 1);
padding: 10px;
text-align: justify;
margin: 0px;
font-size: 18px;
}
ul {
padding: 10px;
padding-bottom: 0px;
padding-top: 0px;
margin: 0px;
li {
width: 100%;
display: inline-block;
border-top: none;
border-bottom: none;
margin-bottom: 10px;
.product_image {
height: 235px;
position: relative;
.featured_badge {
position: absolute;
top: 20px;
left: 0px;
color: #fff;
background-color: rgba(41, 40, 91, 1);
padding: 2px;
padding-left: 10px;
padding-right: 10px;
font-size: 13px;
}
.fav_icon {
position: absolute;
top: 10px;
right: 10px;
font-size: 27px;
width: 30px;
height: 30px;
background-image: url('../../assets/Group32_2.png');
background-position: center;
background-repeat: no-repeat;
background-size: 24px;
}
img {
width: 100%; width: 100%;
background-color: #29285b; height: 100%;
color: #FFF; object-fit: cover;
font-size: 18px; object-position: center;
font-weight: lighter; }
padding-left: 20px;
padding-right: 20px;
margin-bottom: 20px;
margin-top: 20px;
} }
}
.related_product_slider {
h5 { h5 {
color: rgba(41, 40, 91, 1); margin: 0px;
margin: 0px; padding: 0px;
padding: 10px; color: rgba(59, 57, 77, 1);
font-weight: 900; padding-top: 5px;
font-size: 18px; padding-bottom: 5px;
font-weight: 500;
text-align: left;
font-size: 16px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
} }
p { p {
color: rgba(59, 57, 77, 1); margin: 0px;
padding: 10px; padding: 0px;
text-align: justify; color: rgba(176, 174, 199, 1);
margin: 0px; font-size: 12px;
font-size: 18px; text-align: left;
} span {
ul { text-decoration: line-through;
padding: 10px; margin-left: 10px;
padding-bottom: 0px; color: rgba(215, 213, 228, 1);
padding-top: 0px; }
margin: 0px; .offer {
li { color: #fff;
width: 100%; background-color: rgba(41, 40, 91, 1);
display: inline-block; border-radius: 4px;
border-top: none; text-decoration: none;
border-bottom: none; padding: 3px;
margin-bottom: 10px; font-size: 13px;
.product_image { }
height: 235px;
position: relative;
.featured_badge {
position: absolute;
top: 20px;
left: 0px;
color: #fff;
background-color: rgba(41, 40, 91, 1);
padding: 2px;
padding-left: 10px;
padding-right: 10px;
font-size: 13px;
}
.fav_icon {
position: absolute;
top: 10px;
right: 10px;
font-size: 27px;
width: 30px;
height: 30px;
background-image: url("../../assets/Group32_2.png");
background-position: center;
background-repeat: no-repeat;
background-size: 24px;
}
img {
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
}
}
h5 {
margin: 0px;
padding: 0px;
color: rgba(59, 57, 77, 1);
padding-top: 5px;
padding-bottom: 5px;
font-weight: 500;
text-align: left;
font-size: 16px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
p {
margin: 0px;
padding: 0px;
color: rgba(176, 174, 199, 1);
font-size: 12px;
text-align: left;
span {
text-decoration: line-through;
margin-left: 10px;
color: rgba(215, 213, 228, 1)
}
.offer {
color: #fff;
background-color: rgba(41, 40, 91, 1);
border-radius: 4px;
text-decoration: none;
padding: 3px;
font-size: 13px;
}
}
}
} }
}
} }
} }
\ No newline at end of file }
.prodName {
white-space: nowrap;
width: 200px;
overflow: hidden;
text-overflow: ellipsis;
}
...@@ -6,29 +6,58 @@ import { ServiceService } from './../../config/service.service'; ...@@ -6,29 +6,58 @@ import { ServiceService } from './../../config/service.service';
@Component({ @Component({
selector: 'app-orderplaced', selector: 'app-orderplaced',
templateUrl: './orderplaced.page.html', templateUrl: './orderplaced.page.html',
styleUrls: ['./orderplaced.page.scss'], styleUrls: ['./orderplaced.page.scss']
}) })
export class OrderplacedPage implements OnInit { export class OrderplacedPage implements OnInit {
data: any; deliveryTime: any;
timeinterval: any;
constructor( constructor(
private router: Router, private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private location: Location, private location: Location,
private service: ServiceService private service: ServiceService
) { ) {
this.deliveryTime = '';
this.service.get('order').then(val => { this.service.get('order').then(val => {
this.data = val; this.data = val;
this.timeinterval = setInterval(() => {
this.getDeliveryTime(this.data.bookDate.seconds);
}, 1000);
}); });
}
ngOnInit() {
} }
data: any;
relatedProd = { relatedProd = {
slidesPerView: 2 slidesPerView: 2
};
getDeliveryTime(timeStamp) {
console.log(timeStamp);
const endDate = new Date(timeStamp * 1000);
console.log(endDate);
endDate.setHours(endDate.getHours() + 1);
const t = this.getTimeRemaining(endDate, new Date());
const minutes = t.minutes < 10 ? '0' + t.minutes : t.minutes;
const seconds = t.seconds < 10 ? '0' + t.seconds : t.seconds;
this.deliveryTime = minutes + ' : ' + seconds;
if (t.t <= 0) {
clearInterval(this.timeinterval);
}
} }
getTimeRemaining(endtime, currDate) {
const t = Date.parse(endtime) - Date.parse(currDate);
const seconds = Math.floor((t / 1000) % 60);
const minutes = Math.floor((t / 1000 / 60) % 60);
return {
t,
minutes,
seconds
};
}
ngOnInit() {}
goToPage(path, data = null) { goToPage(path, data = null) {
this.router.navigateByUrl(path, { queryParams: data }); this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0; document.body.scrollTop = document.documentElement.scrollTop = 0;
...@@ -36,6 +65,5 @@ export class OrderplacedPage implements OnInit { ...@@ -36,6 +65,5 @@ export class OrderplacedPage implements OnInit {
goBack() { goBack() {
this.location.back(); this.location.back();
} }
} }
...@@ -8,12 +8,19 @@ ...@@ -8,12 +8,19 @@
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<ion-content> <ion-content>
<div class="profile_wrapper"> <div class="profile_wrapper" *ngIf="loggedUser">
<div class="profile_banner"> <div class="profile_banner">
<!-- <div class="profile_circle">
<div class="edit"></div>
</div> -->
<div class="profile_circle"> <div class="profile_circle">
<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)" />
</div> </div>
<h5>{{user && user.name}}</h5>
<h5>{{loggedUser.name}}</h5>
<p (click)="istoggle()">LOGOUT</p> <p (click)="istoggle()">LOGOUT</p>
</div> </div>
<div class="account_wrapper"> <div class="account_wrapper">
...@@ -27,11 +34,13 @@ ...@@ -27,11 +34,13 @@
<ion-row> <ion-row>
<ion-col class="textLeft p0"> <ion-col class="textLeft p0">
<p> <p>
Name<span>{{user && phoneVerified? "Verified": "Not Verified yet"}}</span> Phone
<span *ngIf="loggedUser.phoneVerified == true">Verified</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">
<h6>{{user && user.name}}</h6> <h6>{{loggedUser.phone}}</h6>
</ion-col> </ion-col>
</ion-row> </ion-row>
</div> </div>
...@@ -39,11 +48,12 @@ ...@@ -39,11 +48,12 @@
<ion-row> <ion-row>
<ion-col class="textLeft p0"> <ion-col class="textLeft p0">
<p> <p>
Email<span>{{user && emailVerified? "Verified": "Not Verified yet"}}</span> Email<span *ngIf="userData && userData.emailVerified == true">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">
<h6>{{user && user.emailId}}</h6> <h6>{{loggedUser.emailId}}</h6>
</ion-col> </ion-col>
</ion-row> </ion-row>
</div> </div>
...@@ -81,7 +91,7 @@ ...@@ -81,7 +91,7 @@
<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"> <ion-col class="textRight p0" (click)="goToPage('myorder')">
<h6> <h6>
<ion-icon name="arrow-forward"></ion-icon> <ion-icon name="arrow-forward"></ion-icon>
</h6> </h6>
...@@ -107,12 +117,11 @@ ...@@ -107,12 +117,11 @@
<div class="logout_footer"> <div class="logout_footer">
<button class="btn-cancel floatLeft" (click)="istoggle();">Cancel</button> <button class="btn-cancel floatLeft" (click)="istoggle();">Cancel</button>
<button class="btn-logout floatRight" (click)="istoggle()">Logout</button> <button class="btn-logout floatRight" (click)="authService.SignOut(); istoggle()">Logout</button>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
</div> </div>
</div> </div>
</ion-content> </ion-content>
\ No newline at end of file
.profile_wrapper { .profile_wrapper {
.profile_banner { .profile_banner {
width: 100%;
background-image: url("../../assets/profile_banner.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
text-align: center;
padding-top: 40px;
.profile_circle {
width: 100px;
height: 100px;
background-color: #fff;
border-radius: 50%;
position: relative;
margin: 0 auto;
img {
width: 100%; width: 100%;
height: 100%; background-image: url('../../assets/profile_banner.png');
object-fit: cover; background-position: center;
object-position: center; background-repeat: no-repeat;
border-radius: 50%;
}
.edit {
width: 30px;
height: 30px;
border-radius: 50%;
object-fit: cover;
object-position: center;
background-color: #000;
background-image: url("../../assets/edit_icon.png");
background-size: cover; background-size: cover;
cursor: pointer; text-align: center;
position: absolute; padding-top: 40px;
top: 0px; .profile_circle {
right: 0px; width: 100px;
} height: 100px;
} background-color: #fff;
h5 { border-radius: 50%;
text-align: center; position: relative;
color: #fff; margin: 0 auto;
margin: 0px; img {
padding-top: 15px; width: 100%;
font-weight: 600; height: 100%;
padding-bottom: 5px; object-fit: cover;
} object-position: center;
p { border-radius: 50%;
color: rgba(206, 153, 76, 1); }
text-align: center; input {
margin: 0px; width: 80px;
padding-bottom: 20px; height: 100%;
font-weight: 700; opacity: 0;
} cursor: pointer;
} position: absolute;
.account_wrapper { top: 0px;
width: calc(100% - 40px); left: 0px;
margin: 0 auto; right: 0px;
padding-top: 20px; bottom: 0px;
padding-bottom: 100px; }
.account_header { .edit {
padding-bottom: 15px; width: 30px;
h5 { height: 30px;
margin: 0px; border-radius: 50%;
padding: 0px; object-fit: cover;
color: rgba(59, 57, 77, 1); object-position: center;
font-weight: 900; background-color: #000;
} background-image: url('../../assets/edit_icon.png');
span { background-size: cover;
color: rgba(59, 57, 77, 1); cursor: pointer;
img { position: absolute;
width: 20px; top: 0px;
right: 0px;
}
}
h5 {
text-align: center;
color: #fff;
margin: 0px;
padding-top: 15px;
font-weight: 600;
padding-bottom: 5px;
}
p {
color: rgba(206, 153, 76, 1);
text-align: center;
margin: 0px;
padding-bottom: 20px;
font-weight: 700;
} }
} }
} .account_wrapper {
p { width: calc(100% - 40px);
margin: 0px; margin: 0 auto;
padding: 0px; padding-top: 20px;
color: rgba(176, 174, 199, 1); padding-bottom: 100px;
font-size: 18px; .account_header {
span { padding-bottom: 15px;
color: rgba(206, 153, 76, 1); h5 {
margin-left: 10px; margin: 0px;
} padding: 0px;
} color: rgba(59, 57, 77, 1);
h6 { font-weight: 900;
margin: 0px; }
padding: 0px; span {
color: rgba(59, 57, 77, 1); color: rgba(59, 57, 77, 1);
font-size: 18px; img {
ion-icon { width: 20px;
color: rgba(176, 174, 199, 1); }
} }
} }
.row { p {
padding-bottom: 20px; margin: 0px;
} padding: 0px;
hr { color: rgba(176, 174, 199, 1);
border-bottom: 1px solid rgba(176, 174, 199, .5); font-size: 18px;
height: 0px; span {
border-top: none; color: rgba(206, 153, 76, 1);
margin-top: 15px; margin-left: 10px;
margin-bottom: 15px; }
} }
} h6 {
} margin: 0px;
padding: 0px;
.logout-pop-wrapper { color: rgba(59, 57, 77, 1);
height: 100vh; font-size: 18px;
width: 100%; ion-icon {
position: fixed; color: rgba(176, 174, 199, 1);
top: 0px; }
left: 0px; }
right: 0px; .row {
bottom: 0px; padding-bottom: 20px;
background: rgba(0, 0, 0, 0.6); }
z-index: 99; hr {
.logout_inner { border-bottom: 1px solid rgba(176, 174, 199, 0.5);
margin: 0 auto; height: 0px;
width: 280px; border-top: none;
padding: 10px; margin-top: 15px;
padding-left: 15px; margin-bottom: 15px;
padding-right: 15px; }
padding-bottom: 15px;
background-color: #fff;
position: relative;
-webkit-box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.3);
box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.3);
top: 50%;
border-radius: 10px;
h4 {
text-align: center;
color: rgba(59, 57, 77, 1);
margin: 0px;
font-weight: bold;
padding: 10px;
font-size: 18px;
border-bottom: 1px solid rgba(0, 0, 0, 0.16);
padding-bottom: 20px;
}
p {
text-align: center;
}
.logout_footer {
padding-top: 10px;
button {
border-radius: 8px;
height: 40px;
width: 48%;
color: #fff;
font-size: 15px;
font-weight: lighter;
text-transform: uppercase;
}
.btn-cancel {
border: 1px solid #29285B;
background-color: #29285B;
} }
.btn-logout { .logout-pop-wrapper {
background-color: #fff; height: 100vh;
border: 1px solid rgba(0, 0, 0, 0.16); width: 100%;
color: #000; position: fixed;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
background: rgba(0, 0, 0, 0.6);
z-index: 99;
.logout_inner {
margin: 0 auto;
width: 280px;
padding: 10px;
padding-left: 15px;
padding-right: 15px;
padding-bottom: 15px;
background-color: #fff;
position: relative;
-webkit-box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.3);
box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.3);
top: 50%;
border-radius: 10px;
h4 {
text-align: center;
color: rgba(59, 57, 77, 1);
margin: 0px;
font-weight: bold;
padding: 10px;
font-size: 18px;
border-bottom: 1px solid rgba(0, 0, 0, 0.16);
padding-bottom: 20px;
}
p {
text-align: center;
}
.logout_footer {
padding-top: 10px;
button {
border-radius: 8px;
height: 40px;
width: 48%;
color: #fff;
font-size: 15px;
font-weight: lighter;
text-transform: uppercase;
}
.btn-cancel {
border: 1px solid #29285B;
background-color: #29285B;
}
.btn-logout {
background-color: #fff;
border: 1px solid rgba(0, 0, 0, 0.16);
color: #000;
}
}
}
} }
} }
} \ No newline at end of file
}
\ No newline at end of file
...@@ -2,7 +2,14 @@ import { Component, OnInit } from "@angular/core"; ...@@ -2,7 +2,14 @@ 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 { Router, ActivatedRoute } from "@angular/router"; import { Router, ActivatedRoute } from "@angular/router";
import { finalize, tap } from "rxjs/operators";
import {
AngularFireStorage,
AngularFireStorageReference,
AngularFireUploadTask
} from "@angular/fire/storage";
import { trigger, transition, animate, style } from "@angular/animations"; import { trigger, transition, animate, style } from "@angular/animations";
@Component({ @Component({
...@@ -24,30 +31,32 @@ import { trigger, transition, animate, style } from "@angular/animations"; ...@@ -24,30 +31,32 @@ import { trigger, transition, animate, style } from "@angular/animations";
export class ProfilePage implements OnInit { export class ProfilePage implements OnInit {
user: User; user: User;
userdata: any; userdata: any;
custId: String; custId: string;
isShow = false; isShow = false;
userData: any;
loggedUser: any;
ref: AngularFireStorageReference;
downloadURL;
constructor( constructor(
private router: Router, private router: Router,
private storage: AngularFireStorage,
private useService: UserService, private useService: UserService,
private service: ServiceService private service: ServiceService,
private authService: AuthService
) { ) {
const params = this.useService.users; this.service.get("user").then(data => {
const userdata = this.service.get("user").then(data => {
if (data) { if (data) {
data = JSON.parse(data); this.userData = JSON.parse(data);
this.service.set("params", data); console.log(this.userData);
this.custId = data.uid;
} }
}); });
this.useService.getUserData("9cYSZwGvVpgkUHVcz8Dm6oqGX152"); this.service.get("userData").then(data => {
if (data) {
// .then(res => { this.loggedUser = JSON.parse(data);
// console.log("asdasda", res); }
// this.userdata = res; });
// });
} }
goToPage(path, data = null) { goToPage(path, data = null) {
...@@ -56,10 +65,10 @@ export class ProfilePage implements OnInit { ...@@ -56,10 +65,10 @@ export class ProfilePage implements OnInit {
} }
ngOnInit() { ngOnInit() {
let This = this; const This = this;
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);
} }
...@@ -67,4 +76,41 @@ export class ProfilePage implements OnInit { ...@@ -67,4 +76,41 @@ export class ProfilePage implements OnInit {
istoggle() { istoggle() {
this.isShow = !this.isShow; this.isShow = !this.isShow;
} }
async fileChange(event) {
const fileList: FileList = event.target.files;
if (fileList.length > 0) {
const reader = new FileReader();
let profilePic;
reader.onload = (events: any) => {
profilePic = events.target.result;
this.loggedUser.profilePhoto = events.target.result;
};
profilePic = event.target.result;
reader.readAsDataURL(event.target.files[0]);
const file = fileList[0];
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
.upload(path, file)
.snapshotChanges()
.pipe(
finalize(() => {
ref.getDownloadURL().subscribe(url => {
this.authService.profilePic(url);
});
})
)
.subscribe();
// this.downloadURL = await ref.getDownloadURL().toPromise();
// console.log(this.downloadURL);
}
}
}
} }
...@@ -18,10 +18,6 @@ import { from } from "rxjs"; ...@@ -18,10 +18,6 @@ import { from } from "rxjs";
providedIn: "root" providedIn: "root"
}) })
export class AuthService { export class AuthService {
userData: any;
type: number;
userPostData: any;
constructor( constructor(
public afs: AngularFirestore, public afs: AngularFirestore,
public afAuth: AngularFireAuth, public afAuth: AngularFireAuth,
...@@ -37,6 +33,7 @@ export class AuthService { ...@@ -37,6 +33,7 @@ export class AuthService {
this.userData = user; this.userData = user;
console.log(this.userData); console.log(this.userData);
this.service.set("user", JSON.stringify(this.userData)); this.service.set("user", JSON.stringify(this.userData));
this.SetUserData(user);
if (this.type === 1) { if (this.type === 1) {
this.router.navigateByUrl("home"); this.router.navigateByUrl("home");
} else { } else {
...@@ -51,6 +48,16 @@ export class AuthService { ...@@ -51,6 +48,16 @@ export class AuthService {
}); });
} }
get isLoggedIn(): boolean {
const user = JSON.parse(localStorage.getItem("user"));
return user !== null && user.emailVerified !== false ? true : false;
}
userData: any;
type: number;
userPostData: any;
loggedUser: any;
public asyc;
public async SignIn(email: string, password: string) { public async SignIn(email: string, password: string) {
return this.afAuth.auth return this.afAuth.auth
.signInWithEmailAndPassword(email, password) .signInWithEmailAndPassword(email, password)
...@@ -80,7 +87,7 @@ export class AuthService { ...@@ -80,7 +87,7 @@ export class AuthService {
this.afs this.afs
.collection("customers") .collection("customers")
.doc(this.userData.uid) .doc(this.userData.uid)
.update({ otp: "" }); .update({ otp: "", phoneVerified: true });
this.service.set("type", 1); this.service.set("type", 1);
this.router.navigateByUrl("nearby"); this.router.navigateByUrl("nearby");
} else { } else {
...@@ -89,6 +96,13 @@ export class AuthService { ...@@ -89,6 +96,13 @@ export class AuthService {
}); });
} }
profilePic(pic) {
this.afs
.collection("customers")
.doc(this.userData.uid)
.update({ profilePhoto: pic });
}
public async google(type: number) { public async google(type: number) {
this.type = type; this.type = type;
// this.googlePlus.login({}).then(res => console.log(res)).catch(err => console.error(err)); // this.googlePlus.login({}).then(res => console.log(res)).catch(err => console.error(err));
...@@ -96,8 +110,13 @@ export class AuthService { ...@@ -96,8 +110,13 @@ export class AuthService {
.signInWithPopup(new auth.GoogleAuthProvider()) .signInWithPopup(new auth.GoogleAuthProvider())
.then(result => { .then(result => {
console.log("success"); console.log("success");
console.log(result); console.log(result.additionalUserInfo.isNewUser);
this.socialSignUp(result); if (
result.additionalUserInfo &&
result.additionalUserInfo.isNewUser === true
) {
this.socialSignUp(result);
}
}); });
} }
...@@ -111,11 +130,6 @@ export class AuthService { ...@@ -111,11 +130,6 @@ export class AuthService {
}); });
} }
get isLoggedIn(): boolean {
const user = JSON.parse(localStorage.getItem("user"));
return user !== null && user.emailVerified !== false ? true : false;
}
SetUserData(user: any) { SetUserData(user: any) {
const userRef: AngularFirestoreDocument<any> = this.afs.doc( const userRef: AngularFirestoreDocument<any> = this.afs.doc(
`customers/${user.uid}` `customers/${user.uid}`
...@@ -134,7 +148,9 @@ export class AuthService { ...@@ -134,7 +148,9 @@ export class AuthService {
otp: value.otp, otp: value.otp,
loginType: value.loginType loginType: value.loginType
}; };
console.log(userData); this.loggedUser = userData;
this.service.set("userData", JSON.stringify(this.loggedUser));
console.log(this.loggedUser);
}); });
} }
......
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