Commit 5c5b57d4 by muhsin

conflict

parents 8fa93f08 1abb04f9
import { NgModule } from "@angular/core";
import { PreloadAllModules, RouterModule, Routes } from "@angular/router";
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{
path: "",
loadChildren: "./landing/landing.module#LandingPageModule"
path: '',
loadChildren: './landing/landing.module#LandingPageModule'
},
{ path: "tabs", loadChildren: "./tabs/tabs.module#TabsPageModule" },
{ path: "login", loadChildren: "./login/login.module#LoginPageModule" },
{ path: "signup", loadChildren: "./signup/signup.module#SignupPageModule" },
{ path: 'tabs', loadChildren: './tabs/tabs.module#TabsPageModule' },
{ path: 'login', loadChildren: './login/login.module#LoginPageModule' },
{ path: 'signup', loadChildren: './signup/signup.module#SignupPageModule' },
{
path: "verification",
loadChildren: "./verification/verification.module#VerificationPageModule"
path: 'verification',
loadChildren: './verification/verification.module#VerificationPageModule'
},
{ path: "forgot", loadChildren: "./forgot/forgot.module#ForgotPageModule" },
{ path: 'forgot', loadChildren: './forgot/forgot.module#ForgotPageModule' },
{
path: "changepass",
loadChildren: "./changepass/changepass.module#ChangepassPageModule"
path: 'changepass',
loadChildren: './changepass/changepass.module#ChangepassPageModule'
},
{
path: "orderdelivered",
path: 'orderdelivered',
loadChildren:
"./orderdelivered/orderdelivered.module#OrderdeliveredPageModule"
'./orderdelivered/orderdelivered.module#OrderdeliveredPageModule'
},
{
path: "orderplaced",
loadChildren: "./orderplaced/orderplaced.module#OrderplacedPageModule"
path: 'orderplaced',
loadChildren: './orderplaced/orderplaced.module#OrderplacedPageModule'
},
{
path: "ordercancelled",
path: 'ordercancelled',
loadChildren:
"./ordercancelled/ordercancelled.module#OrdercancelledPageModule"
'./ordercancelled/ordercancelled.module#OrdercancelledPageModule'
},
{
path: "myorder",
loadChildren: "./myorder/myorder.module#MyorderPageModule"
path: 'myorder',
loadChildren: './myorder/myorder.module#MyorderPageModule'
},
{ path: "cart", loadChildren: "./cart/cart.module#CartPageModule" },
{ path: 'cart', loadChildren: './cart/cart.module#CartPageModule' },
{
path: "changedetails",
loadChildren: "./changedetails/changedetails.module#ChangedetailsPageModule"
path: 'changedetails',
loadChildren: './changedetails/changedetails.module#ChangedetailsPageModule'
},
{
path: "wishlist",
loadChildren: "./wishlist/wishlist.module#WishlistPageModule"
path: 'wishlist',
loadChildren: './wishlist/wishlist.module#WishlistPageModule'
},
{
path: "addaddresss",
loadChildren: "./addaddresss/addaddresss.module#AddaddresssPageModule"
path: 'addaddresss',
loadChildren: './addaddresss/addaddresss.module#AddaddresssPageModule'
},
{
path: "profile",
loadChildren: "./profile/profile.module#ProfilePageModule"
path: 'profile',
loadChildren: './profile/profile.module#ProfilePageModule'
},
{ path: "home", loadChildren: "./home/home.module#HomePageModule" },
{ path: 'home', loadChildren: './home/home.module#HomePageModule' },
{
path: "productlist",
loadChildren: "./productlist/productlist.module#ProductlistPageModule"
path: 'productlist',
loadChildren: './productlist/productlist.module#ProductlistPageModule'
},
{
path: "productdetail",
loadChildren: "./productdetail/productdetail.module#ProductdetailPageModule"
path: 'productdetail',
loadChildren: './productdetail/productdetail.module#ProductdetailPageModule'
},
{
path: "reviewlist",
loadChildren: "./reviewlist/reviewlist.module#ReviewlistPageModule"
path: 'reviewlist',
loadChildren: './reviewlist/reviewlist.module#ReviewlistPageModule'
},
{
path: "catagory",
loadChildren: "./catagory/catagory.module#CatagoryPageModule"
path: 'catagory',
loadChildren: './catagory/catagory.module#CatagoryPageModule'
},
{
path: "trackorder",
loadChildren: "./trackorder/trackorder.module#TrackorderPageModule"
path: 'trackorder',
loadChildren: './trackorder/trackorder.module#TrackorderPageModule'
},
{
path: "storelist",
loadChildren: "./storelist/storelist.module#StorelistPageModule"
path: 'storelist',
loadChildren: './storelist/storelist.module#StorelistPageModule'
},
{
path: "catstorelist",
loadChildren: "./catstorelist/catstorelist.module#CatStorelistPageModule"
path: 'catstorelist',
loadChildren: './catstorelist/catstorelist.module#CatStorelistPageModule'
},
{ path: "nearby", loadChildren: "./nearby/nearby.module#NearbyPageModule" },
{ path: "review", loadChildren: "./review/review.module#ReviewPageModule" },
{ path: 'nearby', loadChildren: './nearby/nearby.module#NearbyPageModule' },
{ path: 'review', loadChildren: './review/review.module#ReviewPageModule' },
{
path: "delivery",
loadChildren: "./delivery/delivery.module#DeliveryPageModule"
path: 'delivery',
loadChildren: './delivery/delivery.module#DeliveryPageModule'
},
{
path: "addcard",
loadChildren: "./addcard/addcard.module#AddcardPageModule"
path: 'addcard',
loadChildren: './addcard/addcard.module#AddcardPageModule'
},
{
path: "searchmodal",
loadChildren: "./searchmodal/searchmodal.module#SearchmodalPageModule"
path: 'searchmodal',
loadChildren: './searchmodal/searchmodal.module#SearchmodalPageModule'
}
];
@NgModule({
......
......@@ -56,7 +56,8 @@
<ion-router-outlet main></ion-router-outlet>
</ion-split-pane>
</ion-app>
<div class="common_tab" [hidden]="getState()">
<div class="common_tab" [hidden]="fetchCase() === true">
<ul>
<li (click)="goToPage('home')">
<div
......@@ -72,7 +73,7 @@
(click)="setActive2()"
></div>
</li>
<li (click)="goToPage('catagory')">
<li (click)="searchModal()">
<div
class="icon_sec m3_icon"
[class.m3_icon_act]="sec_active3"
......
import { Component } from "@angular/core";
import { Router, ActivatedRoute } from "@angular/router";
import { Platform } from "@ionic/angular";
import { SplashScreen } from "@ionic-native/splash-screen/ngx";
import { StatusBar } from "@ionic-native/status-bar/ngx";
import { Component } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { Platform, Events } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import {
AngularFirestore,
AngularFirestoreDocument,
AngularFirestoreCollection
} from "@angular/fire/firestore";
import * as firebase from "firebase";
import { ModalController } from "@ionic/angular";
import { DeliverypopPage } from "./deliverypop/deliverypop.page";
import { AuthService } from "./../config/auth.service";
import { ServiceService } from "./../config/service.service";
import { CategoriesService } from "./../config/category.service";
import { User } from "../config/services/user";
import { UserService } from "../config/user.service";
} from '@angular/fire/firestore';
import * as firebase from 'firebase';
import { ModalController } from '@ionic/angular';
import { DeliverypopPage } from './deliverypop/deliverypop.page';
import { AuthService } from './../config/auth.service';
import { ServiceService } from './../config/service.service';
import { SubjectService } from './../config/subject.service';
import { CategoriesService } from './../config/category.service';
import { SearchmodalPage } from './searchmodal/searchmodal.page';
@Component({
selector: "app-root",
templateUrl: "app.component.html",
styleUrls: ["app.component.scss"]
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.scss']
})
export class AppComponent {
sec_active1 = true;
......@@ -28,9 +29,10 @@ export class AppComponent {
sec_active4 = false;
sec_active5 = false;
sec_active6 = false;
state: boolean;
// Customer Info
user: User;
// user: User;
menuw: number;
......@@ -44,20 +46,15 @@ export class AppComponent {
public authService: AuthService,
public service: ServiceService,
public categoryService: CategoriesService,
private route: ActivatedRoute,
private useService: UserService
public subjectService: SubjectService,
private route: ActivatedRoute
) {
this.state = true;
this.initializeApp();
this.orderState();
const userdata = this.service.get("user").then(data => {
if (data) {
data = JSON.parse(data);
console.log(data);
}
this.subjectService.getLoginData().subscribe(loginData => {
this.state = loginData;
});
this.useService.getUserData("9cYSZwGvVpgkUHVcz8Dm6oqGX152");
}
initializeApp() {
......@@ -65,7 +62,7 @@ export class AppComponent {
this.statusBar.styleDefault();
this.statusBar.overlaysWebView(false);
this.statusBar.show();
this.statusBar.backgroundColorByHexString("#29285b");
this.statusBar.backgroundColorByHexString('#29285b');
});
}
......@@ -77,15 +74,20 @@ export class AppComponent {
return await modal.present();
}
ngOnInit() {
let This = this;
setTimeout(() => {
this.user = this.useService.users;
console.log("[usersaaa]", this.user);
}, 500);
fetchCase() {
const restrictedUrl = ['productdetail', 'cart', 'nearby', 'verification'];
const currentUrl = this.router.url.split('/');
const index = restrictedUrl.findIndex(x => x === currentUrl[1]);
// console.log(currentUrl[1], index, this.state);
if (index > -1 || this.state === true) {
return true;
} else {
return false;
}
}
goToPage(path, data = null) {
this.service.set("params", data);
this.service.set('params', data);
this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
......@@ -139,20 +141,16 @@ export class AppComponent {
this.sec_active5 = false;
}
getState() {
return this.service.state;
}
orderState() {
console.log("called");
const custId = "WwHnLICVY2dvZGUHuKqasiTB91a2";
console.log('called');
const custId = 'WwHnLICVY2dvZGUHuKqasiTB91a2';
firebase
.firestore()
.collection("orders")
.where("custId", "==", custId)
.collection('orders')
.where('custId', '==', custId)
.onSnapshot(snapData => {
snapData.docChanges().forEach(change => {
if (change.type === "modified") {
if (change.type === 'modified') {
const data = change.doc.data();
if (data.orderStatus === 7) {
this.finishpop(data);
......@@ -184,4 +182,12 @@ export class AppComponent {
this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
async searchModal() {
const modal = await this.modalController.create({
component: SearchmodalPage
});
modal.onDidDismiss().then(dataReturned => {});
return await modal.present();
}
}
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { RouteReuseStrategy } from "@angular/router";
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from "@ionic/angular";
import { SplashScreen } from "@ionic-native/splash-screen/ngx";
import { StatusBar } from "@ionic-native/status-bar/ngx";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { IonicStorageModule } from "@ionic/storage";
import { GooglePlus } from "@ionic-native/google-plus/ngx";
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { IonicStorageModule } from '@ionic/storage';
import { GooglePlus } from '@ionic-native/google-plus/ngx';
import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from "./app.component";
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { AngularFireModule } from "@angular/fire";
import { AngularFirestore } from "@angular/fire/firestore";
import { AngularFirestoreModule } from "@angular/fire/firestore";
import { AngularFireAuthModule } from "@angular/fire/auth";
import { AngularFireModule } from '@angular/fire';
import { AngularFirestore } from '@angular/fire/firestore';
import { AngularFirestoreModule } from '@angular/fire/firestore';
import { AngularFireAuthModule } from '@angular/fire/auth';
import { Geolocation } from "@ionic-native/geolocation/ngx";
import { NativeGeocoder } from "@ionic-native/native-geocoder/ngx";
import { Geolocation } from '@ionic-native/geolocation/ngx';
import { NativeGeocoder } from '@ionic-native/native-geocoder/ngx';
import { environment } from "../environments/environment";
import { ServiceService } from "./../config/service.service";
import { AuthService } from "./../config/auth.service";
import { from } from "rxjs";
import { DeliverypopPageModule } from "./deliverypop/deliverypop.module";
import { FormsModule } from "@angular/forms";
import { SearchmodalPageModule } from "./searchmodal/searchmodal.module";
import { environment } from '../environments/environment';
import { ServiceService } from './../config/service.service';
import { AuthService } from './../config/auth.service';
import { from } from 'rxjs';
import { DeliverypopPageModule } from './deliverypop/deliverypop.module';
import { FormsModule } from '@angular/forms';
import { SearchmodalPageModule } from './searchmodal/searchmodal.module';
@NgModule({
declarations: [AppComponent],
......
......@@ -82,10 +82,10 @@
<hr>
<h5>
<span class="floatLeft">DELIVERY</span>
<span class="floatRight">EDIT</span>
<span class="floatRight" (click)="istoggle()">EDIT</span>
<div class="clear"></div>
</h5>
<ion-grid class="p0">
<ion-grid class="p0" *ngIf="custAddress">
<ion-row>
<ion-col class="p0">
<h6>
......@@ -192,7 +192,7 @@
<div class="order_placed_div">
<img src="../assets/[email protected]">
<h4>Order Placed</h4>
<p>June 26th 2019, 03:00 PM</p>
<p>{{bookDate}}</p>
<h3>The product will be delivered in</h3>
<h1>60:00 Mins</h1>
<button class="view_order" (click)="goToPage('myorder')">VIEW ORDERS</button><br>
......@@ -223,3 +223,44 @@
</div>
</div>
<div *ngIf="isShow" [@slideInOut]>
<div class="nav_header">
<button class="nav_btn nav_back floatLeft" (click)="istoggle(); setAddress()">
<img src="../assets/Group17_2.png">
</button>
<div class="nav_title floatLeft">
<h4>CHANGE LOCATION</h4>
</div>
<div class="clear"></div>
</div>
<ion-content class="sort_wrappper">
<agm-map [zoom]="20" [latitude]="lat" [longitude]="lng" [disableDefaultUI]="false" [zoomControl]="false" [backgroundColor]="'rgba(29, 27, 130,0.2)'">
<agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
</agm-map>
<div class="add_address_wrapper">
<h5>
<span class="floatLeft">NEW ADDRESS</span>
<span class="floatRight" (click)="istoggle(); goToPage('nearby')">ADD NEW</span>
<div class="clear"></div>
</h5>
<ul *ngIf="addressService.addressList && addressService.addressList.length > 0">
<li *ngFor="let address of addressService.addressList; let i = index">
<div class="floatLeft">{{address.default}}
<input class="styled-checkbox" name="addressId" id="styled-checkbox-{{i}}" type="radio" (click)="setDefault(address.addressId, i)" [value]="address.addressId" #addressType [checked]="address.defaultVal == 1">
<label for="styled-checkbox-{{i}}"> {{address.addressType}}
</label>
</div>
<div class="floatLeft">
<p>
{{address.building}}, {{address.landmark}}, {{address.address}}
</p>
</div>
<div class="clear"></div>
</li>
</ul>
</div>
</ion-content>
</div>
......@@ -453,4 +453,101 @@
font-weight: 300;
float: right;
}
}
.sort_wrappper {
height: 100vh;
width: 100%;
background: #fff;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
z-index: 99;
agm-map {
width: 100%;
height: 100vh;
}
.add_address_wrapper {
position: fixed;
bottom: 0px;
left: 0px;
right: 0px;
padding: 20px;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
background: #fff;
-webkit-box-shadow: 0px -2px 5px 0px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0px -2px 5px 0px rgba(0, 0, 0, 0.2);
box-shadow: 0px -2px 5px 0px rgba(0, 0, 0, 0.2);
h5 {
color: rgba(41, 40, 91, 1);
margin: 0px;
padding: 0px;
font-weight: 800;
}
ul {
margin: 0px;
padding: 0px;
padding-top: 30px;
li {
list-style: none;
margin-bottom: 15px;
p {
margin: 0px;
padding: 0px;
color: rgba(176, 174, 199, 1);
padding-top: 5px;
padding-bottom: 5px;
}
.styled-checkbox {
position: absolute; // take it out of document flow
opacity: 0; // hide it
&+label {
position: relative;
cursor: pointer;
padding: 0;
width: 100%;
}
// Box.
&+label:before {
content: '';
margin-right: 10px;
display: inline-block;
vertical-align: text-top;
width: 20px;
height: 20px;
border-radius: 50%;
background: white;
border: 1px solid rgba(215, 213, 228, 1);
}
&:checked+label:before {
background: #29285b;
}
// Disabled state label.
&:disabled+label {
color: #b8b8b8;
cursor: auto;
}
// Disabled box.
&:disabled+label:before {
box-shadow: none;
background: #ddd;
}
// Checkmark. Could be replaced with an image
&:checked+label:after {
content: '';
position: absolute;
left: 6px;
top: 10px;
background: white;
width: 2px;
height: 2px;
box-shadow: 2px 0 0 white, 4px 0 0 white, 4px -2px 0 white, 4px -4px 0 white, 4px -6px 0 white, 4px -8px 0 white;
transform: rotate(45deg);
}
}
}
}
}
}
\ No newline at end of file
......@@ -8,7 +8,8 @@ import { ModalController } from '@ionic/angular';
import { DeliverypopPage } from '../deliverypop/deliverypop.page';
import { ServiceService } from './../../config/service.service';
import { AddressService } from './../../config/address.service';
import { AddressList } from './../../config/services/address'
import { AddressList } from './../../config/services/address';
import { trigger, transition, animate, style } from '@angular/animations';
import { zip } from 'rxjs';
......@@ -16,11 +17,23 @@ import { zip } from 'rxjs';
selector: 'app-cart',
templateUrl: './cart.page.html',
styleUrls: ['./cart.page.scss'],
animations: [
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%)' }))
])
])
]
})
export class CartPage implements OnInit {
@ViewChild(IonSlides, { static: false }) slides: IonSlides;
currentIndex: any;
isShow = false;
count: any;
gateway: any;
loader = false;
......@@ -36,6 +49,7 @@ export class CartPage implements OnInit {
discountApplied: boolean;
discount: number;
totalAmt: number;
bookDate: any;
constructor(
private router: Router,
......@@ -47,7 +61,7 @@ export class CartPage implements OnInit {
public service: ServiceService,
public addressService: AddressService
) {
this.bookDate = this.formatDate();
this.currentIndex = 0;
this.count = 1;
this.gateway = 1;
......@@ -67,12 +81,19 @@ export class CartPage implements OnInit {
}
ngOnInit() {
let address = this.addressService.addressList.find(x => x.defaultVal === 1);
if (!address) {
address = this.addressService.addressList[0];
console.log(this.addressService.addressList);
this.setAddress();
}
setAddress() {
if (this.addressService.addressList.length > 0) {
let address = this.addressService.addressList.find(x => x.defaultVal === 1);
if (!address) {
address = this.addressService.addressList[0];
}
this.custAddress = address;
}
this.custAddress = address;
console.log(address);
}
getwaypaypal() {
......@@ -118,6 +139,13 @@ export class CartPage implements OnInit {
this.location.back();
}
setDefault(addressId: any, index: number) {
console.log(index);
this.addressService.setDefaultAddress(addressId, this.custId);
console.log(this.addressService.addressList[index]);
this.custAddress = this.addressService.addressList[index];
}
next(index: number = null) {
......@@ -128,18 +156,22 @@ export class CartPage implements OnInit {
}, 500);
console.log(index);
if (index === 2) {
const otherCharges = {
deliveryCharge : this.deliveryCharge,
taxAmount: this.taxAmount,
discount: this.discount,
discountApplied: this.discountApplied,
totalAmt: this.totalAmt,
custAddress: this.custAddress
};
const state = this.orderService.checkOut(this.cartService.carts, otherCharges).then((data) => {
console.log('ready for slide');
this.slides.slideNext();
});
if (this.custAddress !== undefined) {
const otherCharges = {
deliveryCharge : this.deliveryCharge,
taxAmount: this.taxAmount,
discount: this.discount,
discountApplied: this.discountApplied,
totalAmt: this.totalAmt,
custAddress: this.custAddress
};
const state = this.orderService.checkOut(this.cartService.carts, otherCharges).then((data) => {
console.log('ready for slide');
this.slides.slideNext();
});
} else {
alert('Please choose delivery location');
}
} else {
this.slides.slideNext();
}
......@@ -201,4 +233,21 @@ export class CartPage implements OnInit {
});
}
istoggle() {
this.isShow = !this.isShow;
}
formatDate() {
const date = new Date();
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
let hours = date.getHours();
const minutes = date.getMinutes();
const ampm = hours >= 12 ? 'PM' : 'AM';
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
const newminutes = minutes < 10 ? '0' + minutes : minutes;
const strTime = hours + ':' + newminutes + ' ' + ampm;
return months[date.getMonth()] + ' ' + date.getDate() + ',' + date.getFullYear() + ' ' + strTime;
}
}
......@@ -2,6 +2,7 @@ import { Component, OnInit, ViewChild, } from '@angular/core';
import { IonSlides } from '@ionic/angular';
import { Router, ActivatedRoute } from '@angular/router';
import { ServiceService } from './../../config/service.service';
import { SubjectService } from './../../config/subject.service';
@Component({
selector: 'app-landing',
......@@ -9,33 +10,42 @@ import { ServiceService } from './../../config/service.service';
styleUrls: ['./landing.page.scss'],
})
export class LandingPage implements OnInit {
slideOpts = {
initialSlide: 0,
speed: 1000,
allowTouchMove: false
};
@ViewChild(IonSlides, { static: false })slides: IonSlides;
currentIndex: any;
constructor(
private router: Router,
private route: ActivatedRoute,
private service: ServiceService
private service: ServiceService,
public subjectService: SubjectService
) {
this.service.get('landing').then((data) => {
if (data === true) {
const user = JSON.parse(localStorage.getItem('user'));
console.log(user);
if (user) {
this.subjectService.sendLoginData(false);
this.goToPage('home');
} else {
this.subjectService.sendLoginData(true);
this.goToPage('login');
}
}
});
}
slideOpts = {
initialSlide: 0,
speed: 1000,
allowTouchMove: false
};
@ViewChild(IonSlides, { static: false })slides: IonSlides;
currentIndex: any;
landingOptions = {
initialSlide: 1,
speed: 1000,
allowTouchMove: false
};
ngOnInit() {
}
......@@ -45,12 +55,6 @@ export class LandingPage implements OnInit {
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
landingOptions = {
initialSlide: 1,
speed: 1000,
allowTouchMove: false
};
next() {
this.slides.slideNext();
......
......@@ -127,6 +127,8 @@ export class NearbyPage implements OnInit {
if (this.type === 1) {
this.service.set('type', 0);
this.router.navigateByUrl('home', { queryParams: null });
} else {
this.goBack();
}
}, 3000);
}
......
......@@ -18,14 +18,14 @@
(click)="changeFav(product.prodId)"
></div>
<div class="featured_badge" *ngIf="product.featured">Featured</div>
<ion-slides pager="true" [options]="bannerOptions">
<ion-slide>
<ion-slides pager="true" [options]="bannerOptions" *ngIf="slideData">
<ion-slide *ngFor="let prodImg of slideData">
<img
[src]="product.image"
[src]="prodImg"
onerror="this.src='../assets/[email protected]'"
/>
</ion-slide>
<ion-slide>
<!-- <ion-slide>
<img
[src]="product.image"
onerror="this.src='../assets/[email protected]'"
......@@ -36,7 +36,7 @@
[src]="product.image"
onerror="this.src='../assets/[email protected]'"
/>
</ion-slide>
</ion-slide> -->
</ion-slides>
</div>
<div class="product_header">
......@@ -63,12 +63,12 @@
</div>
<div class="product_div_content">
<h5>Color</h5>
<h5 *ngIf="product.color && product.color[0] !=='No-Color'">Color</h5>
<div class="size_div">
<ul *ngIf="product.size">
<ion-slides pager="false" [options]="slideOpts">
<ion-slide *ngFor="let color of product.color; let i = index">
<li>
<li *ngIf="color !=='No-Color'">
<button id="custom_check_button">
<label>
<input
......@@ -87,12 +87,12 @@
</ion-slides>
</ul>
</div>
<h5>Size</h5>
<h5 *ngIf="product.size && product.size[0] !=='Any-Size'">Size</h5>
<div class="size_div">
<ul *ngIf="product.size">
<ion-slides pager="false" [options]="slideOpts">
<ion-slide *ngFor="let size of product.size; let i = index">
<li>
<li *ngIf="size !=='Any-Size'">
<button id="custom_check_button">
<label>
<input
......
import { Component, OnInit } from "@angular/core";
import { Location } from "@angular/common";
import { Router, ActivatedRoute } from "@angular/router";
import { Products } from "./../../config/services/product";
import { Slides } from "./../../config/services/slides";
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 { map } from "rxjs/operators";
import { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common';
import { Router, ActivatedRoute } from '@angular/router';
import { Products } from './../../config/services/product';
import { Slides } from './../../config/services/slides';
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 { map } from 'rxjs/operators';
@Component({
selector: "app-productdetail",
templateUrl: "./productdetail.page.html",
styleUrls: ["./productdetail.page.scss"]
selector: 'app-productdetail',
templateUrl: './productdetail.page.html',
styleUrls: ['./productdetail.page.scss']
})
export class ProductdetailPage implements OnInit {
slide: Slides;
product: Products;
order: Order;
data: any;
slideData: any;
slideData: any[];
bannerOptions = {
slidesPerView: 1,
......@@ -51,18 +51,9 @@ export class ProductdetailPage implements OnInit {
params.subCate,
params.prodId
);
this.service.get("params").then(val => {
this.service.get('params').then(val => {
this.data = val;
});
//
this.prodService
.getProdSlide(this.prodService.selItem.skuCode)
.then(res => {
this.slideData = res;
// console.log("resData", res);
});
this.cartService.cartList();
// console.log(this.prodService.fav);
}
......@@ -76,6 +67,9 @@ export class ProductdetailPage implements OnInit {
getProd(params) {
if (params) {
let slideItem = [];
slideItem.push(params.image);
this.slideData = slideItem;
const prod: Products = {
prodId: params.prodId,
subCate: params.subCate,
......@@ -99,6 +93,10 @@ export class ProductdetailPage implements OnInit {
size: params.size
};
this.product = prod;
this.prodService.fetchGallery(params.skuCode).then((galleryData: any) => {
slideItem = galleryData;
this.slideData = slideItem;
});
} else {
this.product = undefined;
}
......@@ -126,7 +124,7 @@ export class ProductdetailPage implements OnInit {
buyNow(product: any, type: number) {
this.cartService.buyNow(product).then(() => {
if (type === 1) {
this.router.navigateByUrl("cart");
this.router.navigateByUrl('cart');
} else {
// alert('Product added to cart');
}
......@@ -140,7 +138,7 @@ 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_fill' : 'fav_icon';
}
changeFav(index) {
......@@ -149,10 +147,10 @@ export class ProductdetailPage implements OnInit {
// console.log(this.prodService.fav);
if (state > -1) {
this.prodService.fav.splice(state, 1);
this.prodService.changeFav(index, "yes");
this.prodService.changeFav(index, 'yes');
} else {
this.prodService.fav.push(index);
this.prodService.changeFav(index, "no");
this.prodService.changeFav(index, 'no');
}
return;
// console.log(this.prodService.fav);
......
......@@ -44,10 +44,11 @@ export class SignupPage implements OnInit {
private location: Location,
public register: AuthService
) {
console.log(this.currDate.getFullYear() - 10);
this.currDate.setFullYear(this.currDate.getFullYear() - 10);
console.log(this.currDate);
const month = '' + (this.currDate.getMonth() + 1),
day = '' + this.currDate.getDate(),
const month = this.currDate.getMonth() + 1 < 10 ? '0' + (this.currDate.getMonth() + 1) : '' + (this.currDate.getMonth() + 1),
day = this.currDate.getDate() < 10 ? '0' + this.currDate.getDate() : this.currDate.getDate(),
year = this.currDate.getFullYear();
this.minDate = [year, month, day].join('-');
}
......
import { Injectable } from "@angular/core";
import {
AngularFirestore,
AngularFirestoreCollection
} from "@angular/fire/firestore";
import { AddressList, Address } from "./services/address";
import { database } from "firebase";
import { take } from "rxjs/operators";
import { Injectable } from '@angular/core';
import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/firestore';
import { take } from 'rxjs/operators';
import { Address, AddressList } from './services/address';
@Injectable({
providedIn: "root"
providedIn: 'root'
})
export class AddressService {
addressList: AddressList[] = [];
......@@ -18,15 +14,10 @@ export class AddressService {
const This = this;
const state = true;
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"address",
ref => ref.where("status", "==", state).where("uid", "==", userId)
'address',
ref => ref.where('status', '==', state).where('uid', '==', userId)
);
orderRef
.valueChanges()
.pipe(
take(1) // Here you can limit to only emit once, using the take operator
)
.subscribe(value => {
orderRef.valueChanges().subscribe(value => {
this.addressList = [];
const res = value;
if (res.length > 0) {
......@@ -43,7 +34,7 @@ export class AddressService {
};
this.addressList.push(address);
});
// console.log(this.addressList);
console.log(this.addressList);
} else {
// alert('No Orders Found');
}
......@@ -51,16 +42,18 @@ export class AddressService {
}
addressCreate(data: Address) {
console.log(data);
this.afs
.collection("address")
.collection('address')
.add({})
.then(docRef => {
data.addressId = docRef.id;
this.afs
.collection("address")
.collection('address')
.doc(data.addressId)
.set(data)
.then(() => {
this.setDefaultAddress(data.addressId, data.uid);
// console.log('Address created Successfully');
});
});
......@@ -68,19 +61,23 @@ export class AddressService {
setDefaultAddress(addId: string, userId: string) {
this.afs
.collection("address", ref => ref.where("uid", "==", userId))
.collection('address', ref => ref.where('uid', '==', userId))
.get()
.forEach(item => {
return item.docs.map(m => {
return this.afs.doc(`address/${m.id}`).update({ defaultVal: 0 });
});
});
this.afs
.collection("address")
setTimeout(() => {
console.log(addId);
this.afs
.collection('address')
.doc(addId)
.update({ defaultVal: 1 })
.then(() => {
// console.log('Address updated Successfully');
console.log('Address updated Successfully');
});
}, 1000);
}
}
......@@ -5,6 +5,7 @@ import { Router, ActivatedRoute } from '@angular/router';
import { AngularFireAuth } from '@angular/fire/auth';
import { AngularFirestore, AngularFirestoreDocument, AngularFirestoreCollection } from '@angular/fire/firestore';
import { ServiceService } from './../config/service.service';
import { SubjectService } from './../config/subject.service';
import { GooglePlus } from '@ionic-native/google-plus/ngx';
import { take } from 'rxjs/operators';
import { from } from 'rxjs';
......@@ -22,11 +23,13 @@ export class AuthService {
public afAuth: AngularFireAuth,
private router: Router,
private service: ServiceService,
private subjectService: SubjectService,
private googlePlus: GooglePlus
) {
this.type = 1;
this.afAuth.authState.subscribe(user => {
if (user) {
this.subjectService.sendLoginData(false);
this.userData = user;
console.log(this.userData);
this.service.set('user', JSON.stringify(this.userData));
......@@ -36,6 +39,7 @@ export class AuthService {
this.router.navigateByUrl('verification');
}
} else {
this.subjectService.sendLoginData(true);
this.service.set('user', null);
JSON.parse(localStorage.getItem('user'));
this.router.navigateByUrl('login');
......@@ -119,6 +123,7 @@ export class AuthService {
public async SignOut() {
return this.afAuth.auth.signOut().then(() => {
this.subjectService.sendLoginData(true);
this.service.remove('user');
console.log('logout');
});
......
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 { Order, CartProd } from "./services/order";
import { Products } from "./services/product";
import { ServiceService } from "./service.service";
import * as firebase from "firebase";
import { CartItem } from "./services/cart";
import { BehaviorSubject } from "rxjs";
} from '@angular/fire/firestore';
import { Router, ActivatedRoute } from '@angular/router';
import { Order, CartProd } from './services/order';
import { Products } from './services/product';
import { ServiceService } from './service.service';
import * as firebase from 'firebase';
import { CartItem } from './services/cart';
import { BehaviorSubject } from 'rxjs';
@Injectable({
providedIn: "root"
providedIn: 'root'
})
export class OrdersService {
order: Order;
......@@ -29,17 +29,17 @@ export class OrdersService {
public router: Router,
public service: ServiceService
) {
this.size = "small";
this.color = "Blue";
this.custId = "";
this.service.get("user").then(data => {
this.size = 'small';
this.color = 'Blue';
this.custId = '';
this.service.get('user').then(data => {
if (data) {
data = JSON.parse(data);
this.users = data;
this.custId = data.uid;
// console.log(this.custId);
} else {
this.custId = "WwHnLICVY2dvZGUHuKqasiTB91a2";
this.custId = 'WwHnLICVY2dvZGUHuKqasiTB91a2';
}
});
}
......@@ -134,7 +134,7 @@ export class OrdersService {
distinctShops.forEach(item => {
// console.log(item);
this.afs
.collection("orders")
.collection('orders')
.add({
bookDate: firebase.firestore.FieldValue.serverTimestamp()
})
......@@ -155,7 +155,7 @@ export class OrdersService {
color: prodItem.color,
size: prodItem.size,
qty: prodItem.qty,
discount: ""
discount: ''
};
this.afs.doc(`carts/${prodItem.cartId}`).delete();
});
......@@ -163,50 +163,50 @@ export class OrdersService {
// console.log(products);
const product = cartItem[0];
const orderItem: Order = {
amount: "A$ " + otherCharge.totalAmt,
customer: firebase.firestore().doc("/customer/" + this.custId),
amount: 'A$ ' + otherCharge.totalAmt,
customer: firebase.firestore().doc('/customer/' + this.custId),
shopper: product.shopper,
deliveryAddress: otherCharge.custAddress,
deliveryCharge: "A$ " + otherCharge.deliveryCharge,
deliveryCharge: 'A$ ' + otherCharge.deliveryCharge,
deliveryLocation: delivery,
bookDate: firebase.firestore.FieldValue.serverTimestamp(),
orderCode: this.orderCode(),
orderId: neworderId,
orderStatus: 1,
pickupAddress: "GetMi, Canberra, AUS",
pickupAddress: 'GetMi, Canberra, AUS',
pickupLocation: pickup,
promoId: null,
rider: firebase
.firestore()
.doc("/riders/qbTKza18mWVzYG9NLIbmjMbrYjG2"),
.doc('/riders/qbTKza18mWVzYG9NLIbmjMbrYjG2'),
status: 1,
custId: this.custId,
riderId: "qbTKza18mWVzYG9NLIbmjMbrYjG2",
riderId: 'qbTKza18mWVzYG9NLIbmjMbrYjG2',
shopperId: product.shopperId,
custName: "Jone Doe",
riderName: "John",
custName: 'Jone Doe',
riderName: 'John',
shopperState: 0,
shopperName: "Witchery",
shopperName: 'Witchery',
product: products,
discount: "A$ " + otherCharge.discount,
discount: 'A$ ' + otherCharge.discount,
promoApplied: otherCharge.discountApplied,
tax: "A$ " + otherCharge.taxAmount
tax: 'A$ ' + otherCharge.taxAmount
};
// console.log(orderItem);
this.afs
.collection("orders")
.collection('orders')
.doc(neworderId)
.set(orderItem)
.then(() => {
// console.log('Booking Successfully');
// this.router.navigateByUrl('cart');
resolve("Cart to Order Successfully");
resolve('Cart to Order Successfully');
document.body.scrollTop = document.documentElement.scrollTop = 0;
});
})
.catch(error => {
console.error("Error adding document: ", error);
console.error('Error adding document: ', error);
});
});
});
......@@ -216,7 +216,7 @@ export class OrdersService {
public async changeOrder(orderId, status) {
// console.log(orderId, status);
this.afs
.collection("orders")
.collection('orders')
.doc(orderId)
.update({ orderStatus: status });
}
......@@ -227,13 +227,13 @@ export class OrdersService {
orderCode() {
const newpin = Math.round(Math.random() * 1000000);
const orderCode = "GM" + this.pad(newpin, 6, null);
const orderCode = 'GM' + this.pad(newpin, 6, null);
return orderCode;
}
pad(n, width, z) {
z = z || "0";
n = n + "";
z = z || '0';
n = n + '';
return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
}
......
import { Injectable } from "@angular/core";
import {
AngularFirestore,
AngularFirestoreDocument,
AngularFirestoreCollection
} from "@angular/fire/firestore";
import { Products } from "./services/product";
import { Slides } from "./services/slides";
import { ServiceService } from "./../config/service.service";
import { take } from "rxjs/operators";
import { Injectable } from '@angular/core';
import { AngularFirestore, AngularFirestoreCollection, AngularFirestoreDocument } from '@angular/fire/firestore';
import { take } from 'rxjs/operators';
import { ServiceService } from './../config/service.service';
import { Products } from './services/product';
@Injectable({
providedIn: "root"
providedIn: 'root'
})
export class ProductsService {
prodSlideImg: Slides[] = [];
prodSlideImg: any;
product: Products[] = [];
fav: any[];
selItem: Products;
......@@ -24,42 +18,35 @@ export class ProductsService {
this.product = [];
this.fav = [];
this.prodSlideImg = [];
this.service.get("user").then(data => {
this.service.get('user').then(data => {
this.user = JSON.parse(data);
this.getFavlist(this.user.uid);
});
}
// Fetches images for slide
public async getProdSlide(skuID: string) {
public async fetchGallery(skuID: string) {
const This = this;
const state = true;
// firebase query
const prodRef: AngularFirestoreCollection<any> = this.afs.collection(
`product_gallery`,
ref => ref.where("skuId", "==", skuID)
);
prodRef.valueChanges().subscribe(value => {
this.prodSlideImg = [];
const res = value;
if (res.length > 0) {
res.forEach(item => {
const slideImg: Slides = {
downloadURL: item.downloadURL,
imageId: item.imageId,
path: item.path,
skuId: item.skuId
};
this.prodSlideImg.push(slideImg);
});
console.log("[prodSlideImgArray]", this.prodSlideImg);
return this.prodSlideImg;
} else {
// alert("No Products Found");
}
return new Promise (resolve => {
const prodRef: AngularFirestoreCollection<any> = this.afs.collection(
`product_gallery`,
ref => ref.where('skuId', '==', skuID)
);
prodRef.valueChanges().subscribe(value => {
this.prodSlideImg = [];
const res = value;
if (res.length > 0) {
res.forEach((item) => {
this.prodSlideImg.push(item.downloadURL);
});
resolve(this.prodSlideImg);
} else {
resolve(this.prodSlideImg);
}
});
});
}
......@@ -70,7 +57,7 @@ export class ProductsService {
const prodRef: AngularFirestoreCollection<any> = this.afs.collection(
`products`,
ref =>
ref.where("shopperId", "==", shopperId).where("status", "==", state)
ref.where('shopperId', '==', shopperId).where('status', '==', state)
);
prodRef.valueChanges().subscribe(value => {
this.product = [];
......@@ -115,17 +102,17 @@ export class ProductsService {
// console.log(sortValue);
let field, order;
if (sortValue === "low") {
field = "price";
order = "asc";
if (sortValue === 'low') {
field = 'price';
order = 'asc';
}
if (sortValue === "high") {
field = "price";
order = "desc";
if (sortValue === 'high') {
field = 'price';
order = 'desc';
}
if (sortValue === "rate") {
if (sortValue === 'rate') {
// field = 'price';
// order = 'desc';
}
......@@ -133,7 +120,7 @@ export class ProductsService {
// tslint:disable-next-line:max-line-length
const prodRef: AngularFirestoreCollection<any> = this.afs.collection(
`products`,
ref => ref.where("status", "==", state).orderBy(field, order)
ref => ref.where('status', '==', state).orderBy(field, order)
);
prodRef.valueChanges().subscribe(value => {
this.product = [];
......@@ -180,12 +167,12 @@ export class ProductsService {
`products`,
ref =>
ref
.where("shopperId", "==", shopperId)
.where("status", "==", state)
.where("category", "==", category)
.where("subCate", "==", subCate)
.where("prodId", ">", prodId)
.where("prodId", "<", prodId)
.where('shopperId', '==', shopperId)
.where('status', '==', state)
.where('category', '==', category)
.where('subCate', '==', subCate)
.where('prodId', '>', prodId)
.where('prodId', '<', prodId)
);
prodRef.valueChanges().subscribe(value => {
this.similar = [];
......@@ -250,9 +237,9 @@ export class ProductsService {
public async changeFav(index, type) {
// console.log(index, type, this.user.uid);
if (type === "no") {
if (type === 'no') {
this.afs
.collection("favourite")
.collection('favourite')
.doc(this.user.uid)
.valueChanges()
.pipe(
......@@ -261,7 +248,7 @@ export class ProductsService {
.subscribe(value => {
if (value === undefined) {
this.afs
.collection("favourite")
.collection('favourite')
.doc(this.user.uid)
.set({
[index]: true
......@@ -271,14 +258,14 @@ export class ProductsService {
value[index] = true;
// console.log(value);
this.afs
.collection("favourite")
.collection('favourite')
.doc(this.user.uid)
.set(value);
}
});
} else {
this.afs
.collection("favourite")
.collection('favourite')
.doc(this.user.uid)
.valueChanges()
.pipe(
......@@ -289,11 +276,11 @@ export class ProductsService {
if (value !== undefined) {
value[index] = undefined;
Object.keys(value).forEach(key =>
value[key] === undefined ? delete value[key] : ""
value[key] === undefined ? delete value[key] : ''
);
// console.log(value);
this.afs
.collection("favourite")
.collection('favourite')
.doc(this.user.uid)
.set(value);
} else {
......
import { Injectable } from '@angular/core';
import { observable, Observable } from 'rxjs';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
@Injectable({
providedIn: 'root'
})
export class SubjectService {
private loginState = new BehaviorSubject<any>(null);
sendLoginData(state: any) {
this.loginState.next(state);
}
getLoginData(): Observable<any> {
return this.loginState.asObservable();
}
}
import { Injectable } from "@angular/core";
import { Injectable } from '@angular/core';
import {
User,
UpdateUserDetails,
Address,
updatePassword
} from "./services/user";
import { auth } from "firebase/app";
import { Router, ActivatedRoute } from "@angular/router";
import { AngularFireAuth } from "@angular/fire/auth";
UpdatePassword
} from './services/user';
import { auth } from 'firebase/app';
import { Router, ActivatedRoute } from '@angular/router';
import { AngularFireAuth } from '@angular/fire/auth';
import {
AngularFirestore,
AngularFirestoreDocument,
AngularFirestoreCollection
} from "@angular/fire/firestore";
import { ServiceService } from "./../config/service.service";
import { GooglePlus } from "@ionic-native/google-plus/ngx";
import { take } from "rxjs/operators";
import { from } from "rxjs";
} from '@angular/fire/firestore';
import { ServiceService } from './../config/service.service';
import { GooglePlus } from '@ionic-native/google-plus/ngx';
import { take } from 'rxjs/operators';
import { from } from 'rxjs';
@Injectable({
providedIn: "root"
providedIn: 'root'
})
export class UpdateService {
userData: any;
......@@ -63,12 +63,12 @@ export class UpdateService {
this.userPostData = postData;
this.afs
.collection("customers")
.collection('customers')
.doc(uid)
.update(postData)
.then(() => {
console.log("success");
this.router.navigateByUrl("profile");
console.log('success');
this.router.navigateByUrl('profile');
})
.catch(error => {
console.log(error);
......@@ -76,7 +76,7 @@ export class UpdateService {
}
// Change Password
updatePassword(userData: updatePassword) {
updatePassword(userData: UpdatePassword) {
// Gets current user
let user = this.afAuth.auth.currentUser;
let newPassword = userData.password;
......@@ -85,7 +85,7 @@ export class UpdateService {
user
.updatePassword(newPassword)
.then(() => {
console.log("Password Changed");
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