Commit fdd628fd by muhsin

conflix fixx

parents 69a0537c 0b541dde
......@@ -1493,6 +1493,21 @@
"@types/cordova": "^0.0.34"
}
},
"@ionic-native/social-sharing": {
"version": "5.20.0",
"resolved": "https://registry.npmjs.org/@ionic-native/social-sharing/-/social-sharing-5.20.0.tgz",
"integrity": "sha512-YPu4mLf/oOk7Te1A/bxXC5roozAstpRXGSD3G9NdnFVRF6Vd/IT6heKg+grtQCzQXAgr3XP5hcTVhUb+5Tp17w==",
"requires": {
"@types/cordova": "^0.0.34"
},
"dependencies": {
"@types/cordova": {
"version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz",
"integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ="
}
}
},
"@ionic-native/splash-screen": {
"version": "5.19.1",
"resolved": "https://registry.npmjs.org/@ionic-native/splash-screen/-/splash-screen-5.19.1.tgz",
......@@ -3555,6 +3570,11 @@
"resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.4.tgz",
"integrity": "sha512-EYC5eQFVkoYXq39l7tYKE6lEjHJ04mvTmKXxGL7quHLdFPfJMNzru/UYpn92AOfpl3PQaZmou78C7EgmFOwFQQ=="
},
"cordova-plugin-x-socialsharing": {
"version": "5.6.3",
"resolved": "https://registry.npmjs.org/cordova-plugin-x-socialsharing/-/cordova-plugin-x-socialsharing-5.6.3.tgz",
"integrity": "sha512-veAoIOgviGL9RCUyol9e6BxBRpyPV5OWaAmFKglbLjF2uGvj73k+jPe2+2p39ySPetxC8KERAz+1I6tfjk42Zg=="
},
"cordova-sqlite-storage": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/cordova-sqlite-storage/-/cordova-sqlite-storage-3.4.1.tgz",
......@@ -4304,6 +4324,11 @@
"integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==",
"dev": true
},
"es6-promise-plugin": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/es6-promise-plugin/-/es6-promise-plugin-4.2.2.tgz",
"integrity": "sha512-uoA4aVplXI9oqUYJFBAVRwAqIN9/n9JgrTAUGX3qPbnSZVE5yY1+6/MsoN5f4xsaPO62WjPHOdtts6okMN6tNA=="
},
"es6-promisify": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",
......@@ -11655,7 +11680,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
......@@ -11698,7 +11724,8 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
......@@ -11709,7 +11736,8 @@
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
......@@ -11826,7 +11854,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
......@@ -11838,6 +11867,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
......@@ -11867,6 +11897,7 @@
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
......@@ -11885,6 +11916,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
......@@ -11978,6 +12010,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
......@@ -12063,7 +12096,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -12099,6 +12133,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
......@@ -12118,6 +12153,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
......@@ -12161,12 +12197,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},
......@@ -12689,6 +12727,7 @@
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
......@@ -12707,6 +12746,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
......@@ -12886,7 +12926,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -12992,7 +13033,8 @@
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},
......
......@@ -27,6 +27,7 @@
"@ionic-native/geolocation": "^5.19.1",
"@ionic-native/google-plus": "^5.19.1",
"@ionic-native/native-geocoder": "^5.19.1",
"@ionic-native/social-sharing": "^5.20.0",
"@ionic-native/splash-screen": "^5.19.1",
"@ionic-native/status-bar": "^5.19.1",
"@ionic/angular": "^4.11.8",
......@@ -43,8 +44,10 @@
"cordova-plugin-splashscreen": "^5.0.3",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-plugin-x-socialsharing": "^5.6.3",
"cordova-sqlite-storage": "^3.4.1",
"core-js": "^2.6.11",
"es6-promise-plugin": "^4.2.2",
"firebase": "^6.6.2",
"rxjs": "^6.5.4",
"rxjs-compat": "^6.5.4",
......@@ -96,6 +99,9 @@
"cordova-plugin-googleplus": {
"REVERSED_CLIENT_ID": "com.googleusercontent.apps.949385251610-a6lrfr6uhr73991e38t3t013jj3v56a9",
"PLAY_SERVICES_VERSION": "15.0.1"
},
"cordova-plugin-x-socialsharing": {
"ANDROID_SUPPORT_V4_VERSION": "24.1.1+"
}
},
"platforms": [
......
......@@ -6,7 +6,10 @@
<ion-menu-toggle *ngIf="userData">
<div class="top_banner">
<div class="top_image">
<img [src]="userData.profilePhoto" onerror="this.src='./../assets/asset_avatar.png'" />
<img
[src]="userData.profilePhoto"
onerror="this.src='./../assets/asset_avatar.png'"
/>
</div>
<div class="top_detail">
<h4>{{ userData.name }}</h4>
......@@ -17,7 +20,7 @@
</ion-menu-toggle>
<div class="sidemenu_list">
<ul>
<ion-menu-toggle (click)="hideTab()">
<ion-menu-toggle>
<li (click)="vieworder('home')">Shop</li>
</ion-menu-toggle>
<!-- <li>About us</li> -->
......@@ -28,7 +31,10 @@
<div class="sub_menu">
<ul *ngIf="categoryService.activecategories">
<ion-menu-toggle>
<li *ngFor="let category of categoryService.activecategories" (click)="goToPage('catstorelist', category)">
<li
*ngFor="let category of categoryService.activecategories"
(click)="goToPage('catstorelist', category)"
>
{{ category.catName }}
</li>
</ion-menu-toggle>
......@@ -43,7 +49,9 @@
<li (click)="vieworder('feedback')">Complaints & Feedback</li>
</ion-menu-toggle>
<li>
<span class="floatLeft" (click)="authService.SignOut()">Logout</span>
<span class="floatLeft" (click)="authService.SignOut()"
>Logout</span
>
<span class="floatRight version">Version 0.1.0.2</span>
<div class="clear"></div>
</li>
......@@ -59,22 +67,47 @@
<div class="common_tab" [hidden]="fetchCase() === true" *ngIf="!isSearchOpen">
<ul>
<li (click)="goToPage('home')">
<div class="icon_sec m1_icon" [class.m1_icon_act]="sec_active1" (click)="setActive1()"></div>
<div
class="icon_sec m1_icon"
[class.m1_icon_act]="sec_active1"
(click)="setActive1()"
></div>
</li>
<li (click)="goToPage('catagory')">
<div class="icon_sec m2_icon" [class.m2_icon_act]="sec_active2" (click)="setActive2()"></div>
<div
class="icon_sec m2_icon"
[class.m2_icon_act]="sec_active2"
(click)="setActive2()"
></div>
</li>
<li (click)="searchModal()">
<div class="icon_sec m3_icon" [class.m3_icon_act]="sec_active3" (click)="setActive3()"></div>
<div
class="icon_sec m3_icon"
[class.m3_icon_act]="sec_active3"
(click)="setActive3()"
></div>
</li>
<li (click)="goToPage('cart')">
<div class="icon_sec m4_icon" [class.m4_icon_act]="sec_active4" (click)="setActive4()"></div>
<div
class="icon_sec m4_icon"
[class.m4_icon_act]="sec_active4"
(click)="setActive4()"
></div>
</li>
<li (click)="goToPage('myorder')">
<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 (click)="goToPage('profile')">
<div class="icon_sec m6_icon" [class.m6_icon_act]="sec_active6" (click)="setActive6()" menuClose></div>
<div
class="icon_sec m6_icon"
[class.m6_icon_act]="sec_active6"
(click)="setActive6()"
menuClose
></div>
</li>
</ul>
</div>
......@@ -89,10 +89,6 @@ export class AppComponent {
});
}
hideTab() {
alert('asdasdas');
}
async finishpop(data: any) {
const modal = await this.modalController.create({
component: DeliverypopPage,
......@@ -114,7 +110,8 @@ export class AppComponent {
'signup',
'address',
'forgot',
'feedback'
'feedback',
'wishlist'
];
const currentUrl = this.router.url.split('/');
const index = restrictedUrl.findIndex(x => x === currentUrl[1]);
......
......@@ -28,6 +28,7 @@ import { from } from 'rxjs';
import { DeliverypopPageModule } from './deliverypop/deliverypop.module';
import { FormsModule } from '@angular/forms';
import { SearchmodalPageModule } from './searchmodal/searchmodal.module';
import { SocialSharing } from '@ionic-native/social-sharing/ngx';
@NgModule({
declarations: [AppComponent],
......@@ -54,7 +55,8 @@ import { SearchmodalPageModule } from './searchmodal/searchmodal.module';
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
ServiceService,
AuthService,
GooglePlus
GooglePlus,
SocialSharing
],
bootstrap: [AppComponent]
})
......
......@@ -134,8 +134,9 @@
id="cod"
name="radio-group"
checked="true"
(click)="getwaycod()"
/>
<label for="paypal">
<label for="cod">
<p>COD</p>
</label>
</div>
......@@ -145,19 +146,15 @@
name="payments"
id="paypal"
name="radio-group"
checked
(click)="getwaypaypal()"
/>
<label for="test1">
<label for="paypal">
<p>PayPal</p>
</label>
</div>
<div class="card_div" [hidden]="gateway !=1">
<input
class="card_no borderNone widthFull"
placeholder="PayPal ID"
/>
</div>
<!-- <div class="card_div" [hidden]="gateway !=1">
<input class="card_no borderNone widthFull" placeholder="PayPal ID" />
</div> -->
<div class="payment_method">
<input
type="radio"
......@@ -166,14 +163,14 @@
name="radio-group"
(click)="getwayafterpay()"
/>
<label for="test2">
<label for="afterpay">
<p>AfterPay</p>
</label>
</div>
<div class="card_div" [hidden]="gateway !=2">
<!-- <div class="card_div" [hidden]="gateway !=2">
<input class="card_no" placeholder="**** **** **** 1458" />
<input class="cv_number" placeholder="CVV" />
</div>
</div> -->
<div class="payment_method">
<input
type="radio"
......@@ -182,16 +179,16 @@
name="radio-group"
(click)="getwaypayk()"
/>
<label for="test3">
<label for="payk">
<p>PayK</p>
</label>
</div>
<div class="card_div" [hidden]="gateway !=3">
<!-- <div class="card_div" [hidden]="gateway !=3">
<input
class="card_no borderNone widthFull"
placeholder="PafyK ID"
/>
</div>
</div> -->
<!-- <div class="delivery_time">
<ul>
<li>
......@@ -206,14 +203,13 @@
</div> -->
<hr />
<div class="coupon_code">
<input class="" placeholder="COUPON CODE" #promo /><button
class="add_btn"
(click)="promoApply(promo.value)"
>
ADD
<input
class=""
placeholder="COUPON CODE: GET50"
#promo
/><button class="add_btn" (click)="promoApply(promo.value)">
APPLY
</button>
<br />&nbsp;
<h6>GET50</h6>
<span *ngIf="discountApplied" style="color: red"
>Promocode applied successfully
</span>
......@@ -268,7 +264,7 @@
<h4>Order Placed</h4>
<p>{{bookDate}}</p>
<h3>The product will be delivered in</h3>
<h1>60:00 Mins</h1>
<h1>{{deliveryTime}} Mins</h1>
<button class="view_order" (click)="goToPage('myorder')">
VIEW ORDERS</button
><br />
......
......@@ -48,6 +48,7 @@ export class CartPage implements OnInit {
discount: number;
totalAmt: number;
bookDate: any;
timeinterval: any;
constructor(
private router: Router,
......@@ -59,6 +60,7 @@ export class CartPage implements OnInit {
public service: ServiceService,
public addressService: AddressService
) {
console.log('cart loaded');
this.bookDate = this.formatDate();
this.currentIndex = 0;
this.count = 1;
......@@ -67,7 +69,7 @@ export class CartPage implements OnInit {
this.taxAmount = 0;
this.discountApplied = false;
this.discount = 0;
this.cartService.cartList();
// this.cartService.cartList();
this.loader = true;
const users = this.service.get('user').then(data => {
if (data) {
......@@ -86,6 +88,15 @@ export class CartPage implements OnInit {
this.setAddress();
}
ionViewWillEnter() {
const users = this.service.get('user').then(data => {
if (data) {
data = JSON.parse(data);
this.cartService.cartList();
}
});
}
setAddress() {
if (this.addressService.addressList.length > 0) {
let address = this.addressService.addressList.find(
......@@ -123,6 +134,10 @@ export class CartPage implements OnInit {
this.gateway = 3;
}
getwaycod() {
this.gateway = 4;
}
async finishpop() {
const modal = await this.modalController.create({
component: DeliverypopPage
......@@ -167,6 +182,10 @@ export class CartPage implements OnInit {
.checkOut(this.cartService.carts, otherCharges)
.then(data => {
console.log('ready for slide');
const timeStamp = Math.floor(Date.now() / 1000);
this.timeinterval = setInterval(() => {
this.getDeliveryTime(timeStamp);
}, 1000);
this.slides.slideNext();
});
} else {
......@@ -177,6 +196,31 @@ export class CartPage implements OnInit {
}
}
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
};
}
prev() {
this.slides.slidePrev();
}
......
<ion-content>
<div class="cart_wrapper">
<div class="cart_wrapper" *ngIf="data">
<div class="cart_head">
<div class="nav_header">
<button class="nav_btn nav_back_white floatLeft" (click)="goBack()">
<img src="../assets/arrow_white.png">
<button
class="nav_btn nav_back_white floatLeft"
(click)="goToPage('myorder')"
>
<img src="../assets/arrow_white.png" />
</button>
<div class="nav_title floatLeft">
<h4></h4>
</div>
<button class="nav_btn floatRight">
</button>
<button class="nav_btn floatRight"></button>
<div class="clear"></div>
</div>
<img src="../assets/[email protected]">
<img onerror="this.src='../assets/[email protected]'" />
<h4>ORDER CANCELLED</h4>
<p>June 26th 2019, 03:00 PM</p>
<p>{{orderCancelled | date:'MMMM dd, y'}}</p>
</div>
<div class="nearby_shop_list">
<ul>
<li (click)="goToPage('productlist')">
<div class="nearby_image">
<img src="../assets/[email protected]">
<img
[src]="data.product[0].image"
onerror="this.src='../assets/[email protected]'"
/>
</div>
<div class="nearby_detail">
<h5>
<span class="floatLeft">Carnival Life</span>
<span class="floatRight">4
<img src="../assets/Path61_2.png">
<span class="floatLeft">{{data.shopperName}}</span>
<span class="floatRight"
>4
<img src="../assets/Path61_2.png" />
</span>
<div class="clear"></div>
</h5>
......@@ -36,22 +42,34 @@
</li>
</ul>
</div>
<div class="product_detail">
<h6>Green, Small</h6>
<h5>Quantity : <span>3</span></h5>
<h5>Amount : <strong>AU$99.00</strong></h5>
<h5>Delivery time : <span>Delivery in 1 hour</span></h5>
<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></h5>
<h5>Delivery time : <span> 1 hour</span></h5>
<h4>DELIVERY</h4>
<h5>
Shamjith KS<br> +00 0000 888 888<br> Carnival Infopark Infopark Kochi<br> 682030, Kerala, India
<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('productdetail')">BUY NOW</button>
<hr>
<!-- <button
class="cancel_btn"
(click)="goToPage('ordercancelled')"
>
BUY NOW
</button> -->
<!-- <hr /> -->
</div>
<div class="related_product_slider">
<!-- <div class="related_product_slider">
<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>
</h5>
<ul>
......@@ -59,9 +77,8 @@
<ion-slide>
<li (click)="goToPage('productdetail')">
<div class="product_image">
<img src="../assets/[email protected]">
<div class="fav_icon">
</div>
<img src="../assets/[email protected]" />
<div class="fav_icon"></div>
</div>
<h5>European Style V Neck</h5>
<p>AU$99.00</p>
......@@ -70,9 +87,10 @@
<ion-slide>
<li (click)="goToPage('productdetail')">
<div class="product_image">
<img src="../assets/Recommended-Ball-Gown-Floor-Length-V-Neck-Lace-Organza-Prom-Dress-OD850662@3x.png">
<div class="fav_icon">
</div>
<img
src="../assets/Recommended-Ball-Gown-Floor-Length-V-Neck-Lace-Organza-Prom-Dress-OD850662@3x.png"
/>
<div class="fav_icon"></div>
</div>
<h5>European Style V Neck</h5>
<p>AU$99.00</p>
......@@ -81,9 +99,8 @@
<ion-slide>
<li (click)="goToPage('productdetail')">
<div class="product_image">
<img src="../assets/[email protected]">
<div class="fav_icon">
</div>
<img src="../assets/[email protected]" />
<div class="fav_icon"></div>
</div>
<h5>European Style V Neck</h5>
<p>AU$99.00 <span class="offer">-8%</span></p>
......@@ -92,9 +109,8 @@
<ion-slide>
<li (click)="goToPage('productdetail')">
<div class="product_image">
<img src="../assets/[email protected]">
<div class="fav_icon">
</div>
<img src="../assets/[email protected]" />
<div class="fav_icon"></div>
<div class="featured_badge">Featured</div>
</div>
<h5>European Style V Neck</h5>
......@@ -103,6 +119,6 @@
</ion-slide>
</ion-slides>
</ul>
</div>
</div> -->
</div>
</ion-content>
import { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common';
import { Router, ActivatedRoute } from '@angular/router';
import { ServiceService } from './../../config/service.service';
@Component({
selector: 'app-ordercancelled',
templateUrl: './ordercancelled.page.html',
styleUrls: ['./ordercancelled.page.scss'],
styleUrls: ['./ordercancelled.page.scss']
})
export class OrdercancelledPage implements OnInit {
data: any;
orderCancelled = new Date();
constructor(
private router: Router,
private route: ActivatedRoute,
private location: Location
) { }
ngOnInit() {
private location: Location,
private service: ServiceService
) {
this.service.get('order').then(val => {
this.data = val;
});
}
ngOnInit() {}
relatedProd = {
slidesPerView: 2
}
};
goToPage(path, data = null) {
this.router.navigateByUrl(path, { queryParams: data });
......@@ -30,5 +36,4 @@ export class OrdercancelledPage implements OnInit {
goBack() {
this.location.back();
}
}
......@@ -89,7 +89,10 @@
Amount : <strong>A$ {{product.price}}</strong
><span class="afterpay">COD</span>
</h5>
<h5>Delivery time : <span>{{deliveryTime}}</span></h5>
<h5 *ngIf="data.orderStatus >= 3 && data.orderStatus < 7">
Delivery time : <span>{{deliveryTime}}</span>
</h5>
<h5>Order Status : <span>{{getStatus(data.orderStatus)}}</span></h5>
<h4>DELIVERY</h4>
<h5 *ngIf="data.deliveryAddress">
{{data.deliveryAddress.addressType}},<br />{{data.deliveryAddress.address}},
......@@ -97,10 +100,14 @@
{{data.deliveryAddress.building}}, <br />
{{data.deliveryAddress.landmark}}
</h5>
<button class="cancel_btn" (click)="goToPage('ordercancelled')">
<button
class="cancel_btn"
(click)="cancellOrder(data.orderId)"
*ngIf="cancelDelivery > 0 && data.orderStatus != 0 && data.orderStatus != 8"
>
CANCEL THIS ORDER
</button>
<hr />
<!-- <hr /> -->
</div>
<!-- <div class="related_product_slider">
......
......@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common';
import { Router, ActivatedRoute } from '@angular/router';
import { ServiceService } from './../../config/service.service';
import { MyordersService } from './../../config/myorder.service';
@Component({
selector: 'app-orderplaced',
......@@ -10,12 +11,14 @@ import { ServiceService } from './../../config/service.service';
})
export class OrderplacedPage implements OnInit {
deliveryTime: any;
cancelDelivery: any;
timeinterval: any;
constructor(
private router: Router,
private route: ActivatedRoute,
private location: Location,
private service: ServiceService
private service: ServiceService,
private myOrder: MyordersService
) {
this.deliveryTime = '';
this.service.get('order').then(val => {
......@@ -47,6 +50,7 @@ export class OrderplacedPage implements OnInit {
getTimeRemaining(endtime, currDate) {
const t = Date.parse(endtime) - Date.parse(currDate);
this.cancelDelivery = t;
const seconds = Math.floor((t / 1000) % 60);
const minutes = Math.floor((t / 1000 / 60) % 60);
return {
......@@ -66,4 +70,55 @@ export class OrderplacedPage implements OnInit {
goBack() {
this.location.back();
}
cancellOrder(orderId) {
console.log(orderId);
this.myOrder.cancelOrder(orderId).then(() => {
this.service.showToast('Order cancelled!', 'top', 'my-toast', 1000);
const This = this;
setTimeout(() => {
This.goToPage('ordercancelled');
}, 1100);
});
}
getStatus(status: number) {
switch (status) {
case 1:
return 'Booked';
break;
case 2:
return 'Shop Accepted';
break;
case 3:
return 'Rider Assigned';
break;
case 4:
return 'Reached Shop';
break;
case 5:
return 'Picked Up';
break;
case 6:
return 'Reached Location';
break;
case 7:
return 'Delivered';
break;
case 9:
return 'Completed';
break;
case 8:
return 'Rejected';
break;
case 10:
return 'Not Received';
break;
case 0:
return 'Cancelled';
break;
default:
return 'Finished';
}
}
}
......@@ -272,11 +272,17 @@
</div>
</div>
</ion-content>
<ion-footer>
<ion-footer *ngIf="product">
<div class="footer_div">
<div class="footer_options">
<button class="share"></button>
<button class="fav"></button>
<button
class="share"
(click)="socialShare(product.prodName, product.category, product.subCate, product.price, product.image)"
></button>
<button
[ngClass]="checkFavStatus(product.prodId)"
(click)="changeFav(product.prodId)"
></button>
<button
class="cart"
[disabled]="!disCart"
......
......@@ -8,6 +8,7 @@ import { Order } from "./../../config/services/order";
import { CartsService } from "./../../config/cart.service";
import { ProductsService } from "./../../config/products.service";
import { ServiceService } from "./../../config/service.service";
import { SocialSharing } from "@ionic-native/social-sharing/ngx";
import { map } from "rxjs/operators";
@Component({
......@@ -43,7 +44,8 @@ export class ProductdetailPage implements OnInit {
private location: Location,
private cartService: CartsService,
private prodService: ProductsService,
private service: ServiceService
private service: ServiceService,
private socialSharing: SocialSharing
) {
const params = this.prodService.selItem;
this.service.state = true;
......@@ -133,11 +135,7 @@ export class ProductdetailPage implements OnInit {
if (type === 1) {
this.router.navigateByUrl("cart");
} else {
this.disCart = false;
this.service.showToast("Product added to cart", "top", "my-toast", 500);
setTimeout(() => {
this.disCart = true;
}, 600);
this.service.showToast("Added into cart", "top", "my-toast", 2000);
}
this.cartService.cartList();
});
......@@ -149,10 +147,11 @@ export class ProductdetailPage implements OnInit {
checkFavStatus(index) {
const state = this.prodService.fav.findIndex(x => x === index);
return state > -1 ? "fav_fill" : "fav_icon";
return state > -1 ? "fav_active" : "fav";
}
changeFav(index) {
this.prodService.changeFav(index, "yes");
const state = this.prodService.fav.findIndex(x => x === index);
// console.log(state);
// console.log(this.prodService.fav);
......@@ -166,4 +165,15 @@ export class ProductdetailPage implements OnInit {
return;
// console.log(this.prodService.fav);
}
socialShare(prodName, category, subCate, price, image) {
const desc = category + ", " + subCate + ", " + price;
const content = {
message: desc, // not supported on some apps (Facebook, Instagram)
subject: prodName, // fi. for email
files: image,
chooserTitle: "GetMi"
};
this.socialSharing.shareWithOptions(content);
}
}
......@@ -112,6 +112,17 @@
<li>
<input
class="styled-checkbox"
id="styled-checkbox-1"
type="radio"
value="newest"
name="sort"
(click)="setValue($event.target.value)"
/>
<label for="styled-checkbox-1">Newest First</label>
</li>
<li>
<input
class="styled-checkbox"
id="styled-checkbox-5"
type="radio"
value="a-z"
......
......@@ -33,6 +33,7 @@ export class ProductlistPage implements OnInit {
sortValue: string;
loader: boolean;
shopperId: any;
custId: any;
constructor(
private router: Router,
......@@ -54,10 +55,25 @@ export class ProductlistPage implements OnInit {
this.loader = false;
}, 2000);
});
const users = this.service.get('user').then(data => {
if (data) {
data = JSON.parse(data);
this.custId = data.uid;
}
});
}
ngOnInit() {}
ionViewWillEnter() {
const users = this.service.get('user').then(data => {
if (data) {
data = JSON.parse(data);
this.prodService.getFavlist(data.uid);
}
});
}
goToPage(path, data = null) {
this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
......
......@@ -16,7 +16,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>
......@@ -27,8 +30,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,13 +42,16 @@
<ion-col class="textLeft p0">
<p>
Phone
</p>
</ion-col>
<ion-col class="textRight p0">
<h6>{{loggedUser.phone}}</h6>
<span class="ar-span" *ngIf="loggedUser.phoneVerified == true">Verified</span>
<span class="ar-span" *ngIf="loggedUser.phoneVerified == false">Not Verified yet</span>
<span class="ar-span" *ngIf="loggedUser.phoneVerified == true"
>Verified</span
>
<span class="ar-span" *ngIf="loggedUser.phoneVerified == false"
>Not Verified yet</span
>
</ion-col>
</ion-row>
</div>
......@@ -55,8 +64,12 @@
</ion-col>
<ion-col class="textRight p0">
<h6>{{loggedUser.emailId}}</h6>
<span class="ar-span" *ngIf="loggedUser.emailVerified == true">Verified</span>
<span class="ar-span" *ngIf="loggedUser.emailVerified == false">Not Verified yet</span>
<span class="ar-span" *ngIf="loggedUser.emailVerified == true"
>Verified</span
>
<span class="ar-span" *ngIf="loggedUser.emailVerified == false"
>Not Verified yet</span
>
</ion-col>
</ion-row>
</div>
......@@ -66,7 +79,9 @@
<p>Wishlist</p>
</ion-col>
<ion-col class="textRight p0">
<h6>(0)</h6>
<h6 *ngIf="wishService.whishItem">
({{wishService.whishItem.length}})
</h6>
</ion-col>
</ion-row>
<hr />
......@@ -122,7 +137,10 @@
<button class="btn-cancel floatLeft" (click)="istoggle();">
Cancel
</button>
<button class="btn-logout floatRight" (click)="authService.SignOut(); istoggle()">
<button
class="btn-logout floatRight"
(click)="authService.SignOut(); istoggle()"
>
Logout
</button>
</div>
......
......@@ -7,6 +7,7 @@ import { Router, ActivatedRoute } from '@angular/router';
import { finalize, tap } from 'rxjs/operators';
import { Location } from '@angular/common';
import { AddressService } from './../../config/address.service';
import { WishService } from './../../config/wish.service';
import {
AngularFireStorage,
AngularFireStorageReference,
......@@ -48,11 +49,13 @@ export class ProfilePage implements OnInit {
private service: ServiceService,
private authService: AuthService,
private addressService: AddressService,
private wishService: WishService,
private location: Location
) {
this.service.get('user').then(data => {
if (data) {
this.userData = JSON.parse(data);
this.wishService.wishList(this.userData.uid);
console.log(this.userData);
}
});
......
......@@ -10,44 +10,50 @@
<ion-content>
<div class="wishlist-wrapper">
<ul>
<li>
<div class="wishlist_image">
<img src="../../assets/img-list.png" />
<ul *ngIf="wishService.whishItem && wishService.whishItem.length > 0">
<li *ngFor="let product of wishService.whishItem; let i = index">
<div class="wishlist_image" (click)="prodDetails(i)">
<img
[src]="product.image"
onerror="this.src='../../assets/img-list.png'"
/>
</div>
<div class="wishlist_detail">
<p class="floatLeft">European Style V Neck</p>
<span class="floatRight"><img src="../../assets/heart.png"/></span>
<p class="floatLeft" (click)="prodDetails(i)">{{product.prodName}}</p>
<span class="floatRight"
><img
src="../../assets/heart.png"
(click)="removeItem(product.prodId)"
/></span>
<div class="clear"></div>
<p>Green, Small</p>
<h1>AU$88.00</h1>
</div>
<div class="clear"></div>
</li>
<li>
<div class="wishlist_image">
<img src="../../assets/img-list.png" />
</div>
<div class="wishlist_detail">
<p class="floatLeft">European Style V Neck</p>
<span class="floatRight"><img src="../../assets/heart.png"/></span>
<div class="clear"></div>
<p>Green, Small</p>
<h1>AU$88.00</h1>
<p (click)="prodDetails(i)">
<span *ngIf="product.color[0] !=='No-Color'"
>{{product.color[0]}}</span
>,
<span *ngIf="product.size[0] !=='Any-Size'"
>{{product.size[0]}}</span
>
</p>
<h1 (click)="prodDetails(i)">A$ {{product.price}}</h1>
</div>
<div class="clear"></div>
</li>
</ul>
</div>
<!--
<div class="empty-wishlist-wrapper">
<div class="empty-wishlist-wrapper" *ngIf="wishService.whishItem.length == 0">
<img src="../../assets/wishlist.png" />
<h1>There is no products added</h1>
<button (click)="goToPage('home')">shop now</button>
</div> -->
</div>
<div class="footer-btns-wrapper">
<button class="btn-clear">Clear All</button>
<button class="btn-cart">add all to cart</button>
<div class="footer-btns-wrapper" *ngIf="wishService.whishItem.length > 0">
<button class="btn-clear" (click)="clearAll()">Clear All</button>
<button class="btn-cart" (click)="addToCart()">add all to cart</button>
</div>
</ion-content>
<div class="loader" *ngIf="loader">
<div class="lds-ripple">
<div></div>
<div></div>
</div>
</div>
import { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common';
import { Router, ActivatedRoute } from '@angular/router';
import { ServiceService } from './../../config/service.service';
import { WishService } from './../../config/wish.service';
import { ProductsService } from './../../config/products.service';
@Component({
selector: 'app-wishlist',
......@@ -8,7 +11,27 @@ import { Router, ActivatedRoute } from '@angular/router';
styleUrls: ['./wishlist.page.scss']
})
export class WishlistPage implements OnInit {
constructor(private location: Location, private router: Router) {}
custId: any;
loader: boolean;
constructor(
private location: Location,
private router: Router,
public service: ServiceService,
public wishService: WishService,
public prodService: ProductsService
) {
this.loader = true;
setTimeout(() => {
this.loader = false;
}, 2000);
const users = this.service.get('user').then(data => {
if (data) {
data = JSON.parse(data);
this.custId = data.uid;
this.wishService.wishList(this.custId);
}
});
}
ngOnInit() {}
......@@ -16,8 +39,80 @@ export class WishlistPage implements OnInit {
this.location.back();
}
clearAll() {
this.loader = true;
this.wishService
.clearWish(this.custId)
.then(data => {
this.loader = false;
this.service.showToast(
'Wish list cleared successfully',
'top',
'my-toast',
2000
);
})
.catch(err => {
this.loader = false;
this.service.showToast('Something went wrong', 'top', 'my-error', 1000);
});
}
addToCart() {
this.loader = true;
this.wishService
.addToCart(this.custId, this.wishService.whishItem)
.then(data => {
this.wishService
.clearWish(this.custId)
.then(datas => {
this.loader = false;
this.service.showToast('Added to cart', 'top', 'my-toast', 2000);
})
.catch(err => {
this.loader = false;
this.service.showToast(
'Something went wrong',
'top',
'my-error',
1000
);
});
})
.catch(err => {
this.loader = false;
this.service.showToast('Something went wrong', 'top', 'my-error', 1000);
});
}
removeItem(prodId) {
this.loader = true;
this.wishService
.clearWishItem(this.custId, prodId)
.then(data => {
this.loader = false;
this.service.showToast(
'Wish list cleared successfully',
'top',
'my-toast',
2000
);
})
.catch(err => {
this.loader = false;
this.service.showToast('Something went wrong', 'top', 'my-error', 1000);
});
}
goToPage(path, data = null) {
this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
prodDetails(index: number) {
console.log(this.wishService.whishItem[index]);
this.prodService.setProd(this.wishService.whishItem[index]);
this.router.navigateByUrl('productdetail');
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
}
......@@ -121,6 +121,7 @@ export class CartsService {
}
public async cartList() {
console.log('called');
const cartRef: AngularFirestoreCollection<any> = this.afs.collection(
'carts',
ref => ref.where('custId', '==', this.custId)
......
......@@ -79,6 +79,20 @@ export class MyordersService {
});
}*/
public async cancelOrder(orderId) {
const promise = new Promise(resolve => {
this.afs
.collection('orders')
.doc(orderId)
.update({
orderStatus: 0,
cancelTime: firebase.firestore.FieldValue.serverTimestamp()
});
resolve(true);
});
return promise;
}
public async orderList(custId) {
// console.log('called');
// console.log(custId);
......@@ -86,7 +100,7 @@ export class MyordersService {
this.orders = [];
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
'orders',
ref => ref.where('custId', '==', custId).orderBy('bookDate', 'desc')
ref => ref.where('custId', '==', custId).orderBy('orderDate', 'desc')
);
orderRef.stateChanges().subscribe(value => {
// console.log(value);
......@@ -100,6 +114,7 @@ export class MyordersService {
const order: Myorder = {
amount: item.amount,
status: item.status,
orderDate: item.orderDate,
orderStatus: item.orderStatus,
bookDate: item.bookDate,
deliveryLocation: item.deliveryLocation,
......@@ -122,6 +137,7 @@ export class MyordersService {
}
}
});
this.orders.sort((a, b) => Number(b.orderDate) - Number(a.orderDate));
// console.log(this.orders);
}
});
......
......@@ -170,6 +170,7 @@ export class OrdersService {
deliveryCharge: 'A$ ' + otherCharge.deliveryCharge,
deliveryLocation: delivery,
bookDate: firebase.firestore.FieldValue.serverTimestamp(),
orderDate: Math.floor(Date.now() / 1000),
orderCode: this.orderCode(),
orderId: neworderId,
orderStatus: 1,
......
......@@ -125,6 +125,11 @@ export class ProductsService {
order = 'asc';
}
if (sortValue === 'newest') {
field = 'createdAt';
order = 'asc';
}
// tslint:disable-next-line:max-line-length
const prodRef: AngularFirestoreCollection<any> = this.afs.collection(
`products`,
......
export interface Myorder {
amount: string;
bookDate: any;
orderDate: any;
pickupLocation: any;
deliveryLocation: any;
deliveryAddress: any;
......@@ -12,4 +13,3 @@ export interface Myorder {
product: any;
orderCode: string;
}
......@@ -53,6 +53,7 @@ export interface Order {
pickupAddress: string;
pickupLocation: object;
bookDate: any;
orderDate: any;
custId: string;
promoId: any;
rider: any;
......@@ -68,6 +69,3 @@ export interface Order {
discount: string;
promoApplied: boolean;
}
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;
prodId: string;
shopperId: any;
shopper: any;
prodName: any;
image: string;
size: any;
color: any;
qty: number;
price: number;
}
import { Injectable } from '@angular/core';
import {
AngularFirestore,
AngularFirestoreDocument
} from '@angular/fire/firestore';
import { Router } from '@angular/router';
import { ServiceService } from './service.service';
import { CartsService } from './cart.service';
import { Products } from './services/product';
import { User } from './services/user';
import { take } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class WishService {
wish: Products;
user: User;
whishItem: Products[] = [];
wishItems: any;
constructor(
public afs: AngularFirestore,
public router: Router,
public service: ServiceService,
public cartService: CartsService
) {
this.whishItem = [];
}
public async wishList(custId) {
console.log(custId);
const cartRef: AngularFirestoreDocument<any> = this.afs
.collection('favourite')
.doc(custId);
this.whishItem = [];
cartRef.valueChanges().subscribe(value => {
this.whishItem = [];
console.log(value);
this.wishItems = value;
/* value = this.service.key2Array(value);
console.log(value); */
// tslint:disable-next-line:forin
for (const i in value) {
const prodRef: AngularFirestoreDocument<any> = this.afs
.collection('products')
.doc(i);
prodRef
.valueChanges()
.pipe(
take(1) // Here you can limit to only emit once, using the take operator
)
.subscribe(prodValue => {
console.log(prodValue);
if (prodValue) {
const item = prodValue;
const wishItem: Products = {
color: this.service.splitSep(item.color),
shopperId: item.shopperId,
shopper: item.shopper,
prodId: item.prodId,
price: item.price,
prodName: item.prodName,
image: item.image,
qty: 1,
brand: item.brand,
category: item.category,
discount: item.discount,
featured: item.featured,
prodCode: item.prodCode,
prodDesc: item.prodDesc,
prodStatus: item.prodStatus,
rating: item.rating,
skuCode: item.skuCode,
status: item.status,
subCate: item.subCate,
tag: this.service.splitSep(item.tag),
size: this.service.splitSep(item.size)
};
const found = this.whishItem.some(
el => el.prodId === item.prodId
);
if (!found) {
this.whishItem.push(wishItem);
}
console.log(this.whishItem);
} else {
// alert('No Products Found');
}
});
}
});
}
clearWish(custId) {
const promise = new Promise(resolve => {
this.afs
.collection('favourite')
.doc(custId)
.delete();
resolve(true);
});
return promise;
}
clearWishItem(custId, prodId) {
delete this.wishItems[prodId];
console.log(custId, prodId);
const promise = new Promise(resolve => {
this.afs
.collection('favourite')
.doc(custId)
.set(this.wishItems);
resolve(true);
}).catch(err => {
console.log(err);
});
return promise;
}
addToCart(custId, items) {
const promise = new Promise(resolve => {
items.forEach(item => {
this.cartService.buyNow(item);
});
resolve(true);
});
return promise;
}
}
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