diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 389cbfd..d98fbd7 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -138,4 +138,4 @@ const routes: Routes = [ ], exports: [RouterModule] }) -export class AppRoutingModule {} +export class AppRoutingModule { } diff --git a/src/app/app.component.html b/src/app/app.component.html index 33adb2f..f706b9f 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -28,7 +28,8 @@ <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> diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 4349623..1db345e 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -95,6 +95,10 @@ export class AppComponent { }); } + ionViewWillEnter() { + alert('enter'); + } + initializeApp() { this.platform.ready().then(() => { this.statusBar.styleDefault(); @@ -147,7 +151,9 @@ export class AppComponent { } goToPage(path, data = null) { - this.service.set('params', data); + if (data !== null) { + this.service.set('catParams', data); + } this.router.navigateByUrl(path, { queryParams: data }); document.body.scrollTop = document.documentElement.scrollTop = 0; } diff --git a/src/app/cart/cart.page.html b/src/app/cart/cart.page.html index 7a0285b..58eacdf 100644 --- a/src/app/cart/cart.page.html +++ b/src/app/cart/cart.page.html @@ -36,7 +36,7 @@ <li *ngFor="let carts of cartService.carts; let i= index"> <div class="close" (click)="cartService.removeItem(i)"></div> <div class="cart_image"> - <img [src]="carts.image" onerror="this.src=''" /> + <img [src]="carts.image" onerror="this.src='./../../assets/cart.png'" /> </div> <div class="cart_detail"> <h4>{{unEscape(carts.prodName)}}</h4> @@ -59,7 +59,7 @@ <p class="textLeft">Total Price:</p> </ion-col> <ion-col> - <p class="textRight">A$ {{cartService.cartTotal}}</p> + <p class="textRight">A$ {{cartService.cartTotal.toFixed(2)}}</p> </ion-col> </ion-row> </div> @@ -112,7 +112,7 @@ <hr /> <h5> <span class="floatLeft">PAYMENT</span> - <span class="floatRight">CHANGE</span> + <!-- <span class="floatRight">CHANGE</span> --> <div class="clear"></div> </h5> <div class="payment_method"> @@ -171,8 +171,8 @@ <hr /> <div class="coupon_code"> <div class="promo-row"> - <input class="" placeholder="COUPON CODE: GET50" #promo /><button class="add_btn" - (click)="promoApply(promo.value)"> + <input class="" placeholder="COUPON CODE: GET50" #promo /><button + class="add_btn apply_btn" (click)="promoApply(promo.value)"> APPLY </button> </div> @@ -185,7 +185,7 @@ <h6> <span class="floatLeft">PRODUCT COST</span> <span class="floatRight" *ngIf="cartService.cartTotal">A$ - {{cartService.cartTotal}}</span> + {{cartService.cartTotal.toFixed(2)}}</span> <div class="clear"></div> </h6> @@ -240,7 +240,7 @@ </ion-content> <ion-footer> <div class="footer_btnbay" *ngIf="cartService.carts && cartService.carts.length > 0" [hidden]="currentIndex != 0"> - <div class="continue" (click)="goToPage('productlist')"> + <div class="continue" (click)="goToPage('home')"> CONTINUE SHOPPING </div> <div class="checkout" (click)="next(1)">CHECKOUT</div> diff --git a/src/app/cart/cart.page.scss b/src/app/cart/cart.page.scss index b5a3cac..2579996 100644 --- a/src/app/cart/cart.page.scss +++ b/src/app/cart/cart.page.scss @@ -236,6 +236,9 @@ font-size: 17px; font-weight: bolder; } + .apply_btn { + display: flex; + } } .promo-success { color: #31b131; diff --git a/src/app/cart/cart.page.ts b/src/app/cart/cart.page.ts index 1c3a42e..b98fef3 100644 --- a/src/app/cart/cart.page.ts +++ b/src/app/cart/cart.page.ts @@ -341,6 +341,7 @@ export class CartPage implements OnInit { } unEscape(text: string) { - return unescape(text); + const regex = '%uFFFD'; + return unescape(text.replace(/%uFFFD/g, '')); } } diff --git a/src/app/catagory/catagory.page.scss b/src/app/catagory/catagory.page.scss index 0e728df..24462c3 100644 --- a/src/app/catagory/catagory.page.scss +++ b/src/app/catagory/catagory.page.scss @@ -165,7 +165,7 @@ p { margin: 0px; padding: 0px; - color: rgba(176, 174, 199); + color: rgb(176, 174, 199); } } } diff --git a/src/app/catagory/catagory.page.ts b/src/app/catagory/catagory.page.ts index 4fd589f..d1fe307 100644 --- a/src/app/catagory/catagory.page.ts +++ b/src/app/catagory/catagory.page.ts @@ -23,16 +23,16 @@ export class CatagoryPage implements OnInit { private subjectService: SubjectService, public modalController: ModalController ) { - this.service.get('params').then((val) => { + /* this.service.get('catParams').then((val) => { this.data = val; - }); + }); */ } ngOnInit() { } goToPage(path, data = null) { - this.service.set('params', data); + this.service.set('catParams', data); this.router.navigateByUrl(path, { queryParams: data }); document.body.scrollTop = document.documentElement.scrollTop = 0; } diff --git a/src/app/catstorelist/catstorelist.page.html b/src/app/catstorelist/catstorelist.page.html index 6f55c0f..08091e8 100644 --- a/src/app/catstorelist/catstorelist.page.html +++ b/src/app/catstorelist/catstorelist.page.html @@ -1,18 +1,10 @@ <div class="nav_header"> <button class="nav_btn nav_back floatLeft" (click)="goBack()"></button> <div class="nav_title floatLeft"> - <input - class="search_bar" - placeholder="Search here.. eg:shirts, retailers etc..." - (click)="clickSearch()" - /> + <input class="search_bar" placeholder="Search here.. eg:shirts, retailers etc..." (click)="clickSearch()" /> </div> <button class="nav_btn nav_search floatRight" *ngIf="!searchShow"></button> - <button - class="nav_btn nav_close floatRight" - *ngIf="searchShow" - (click)="searchClose()" - ></button> + <button class="nav_btn nav_close floatRight" *ngIf="searchShow" (click)="searchClose()"></button> <div class="clear"></div> </div> <ion-content> @@ -21,20 +13,11 @@ Featured Stores </div> <div class="featured_slider"> - <ion-slides - pager="false" - [options]="slideOpts" - *ngIf="shopperService.activeshoppers && shopperService.activeshoppers.length > 0" - > + <ion-slides pager="false" [options]="slideOpts" + *ngIf="shopperService.activeshoppers && shopperService.activeshoppers.length > 0"> <ion-slide *ngFor="let shopper of shopperService.activeshoppers"> - <div - class="feature_product" - (click)="goToPage('productlist', shopper)" - > - <img - [src]="shopper.featuredImage" - onerror="this.src='./../../assets/getmi_malls/featured/featured1.png'" - /> + <div class="feature_product" (click)="goToPage('productlist', shopper)"> + <img [src]="shopper.featuredImage" onerror="this.src='./../../assets/getmi_malls/featured/featured1.png'" /> <div class="feature_overlay"> <h5>{{shopper.name}}</h5> <p>{{shopper.caption}}</p> @@ -48,21 +31,14 @@ </div> <div class="nearby_shop_list"> <ul *ngIf="shopperService.shoppers && shopperService.shoppers.length > 0"> - <li - *ngFor="let shopper of shopperService.shoppers" - (click)="goToPage('productlist', shopper)" - > + <li *ngFor="let shopper of shopperService.shoppers" (click)="goToPage('productlist', shopper)"> <div class="nearby_image"> - <img - [src]="shopper.profilePic" - onerror="this.src='./../../assets/getmi_malls/store298/stores1.png'" - /> + <img [src]="shopper.profilePhoto" onerror="this.src='./../../assets/getmi_malls/store298/stores1.png'" /> </div> <div class="nearby_detail"> <h5> <span class="floatLeft">{{shopper.name}}</span> - <span class="floatRight" - >0 + <span class="floatRight">0 <img src="../assets/Path61_2.png" /> </span> <div class="clear"></div> @@ -72,14 +48,11 @@ <div class="clear"></div> </li> </ul> - <div - class="no-result-wrapper" - *ngIf="shopperService.shoppers.length === 0" - > + <div class="no-result-wrapper" *ngIf="shopperService.shoppers.length === 0"> <img src="../../assets/basket.png" /> <h1>No result found</h1> <button (click)="goToPage('home')">home</button> </div> </div> </div> -</ion-content> +</ion-content> \ No newline at end of file diff --git a/src/app/catstorelist/catstorelist.page.scss b/src/app/catstorelist/catstorelist.page.scss index 4a2ff4a..ff9ccfa 100644 --- a/src/app/catstorelist/catstorelist.page.scss +++ b/src/app/catstorelist/catstorelist.page.scss @@ -180,7 +180,7 @@ p { margin: 0px; padding: 0px; - color: rgba(176, 174, 199); + color: rgb(176, 174, 199); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; diff --git a/src/app/catstorelist/catstorelist.page.ts b/src/app/catstorelist/catstorelist.page.ts index e3e84bf..e292c84 100644 --- a/src/app/catstorelist/catstorelist.page.ts +++ b/src/app/catstorelist/catstorelist.page.ts @@ -41,7 +41,7 @@ export class CatStorelistPage implements OnInit { private modalController: ModalController, private subjectService: SubjectService ) { - this.service.get('params').then(val => { + this.service.get('catParams').then(val => { this.data = val; this.shopperService.shopperList(this.data.catId, 'catId'); }); @@ -61,10 +61,10 @@ export class CatStorelistPage implements OnInit { searchClose() { this.searchShow = false; } - ngOnInit() {} + ngOnInit() { } goToPage(path, data = null) { - this.service.set('params', data); + this.service.set('shopParams', data); this.router.navigateByUrl(path, { queryParams: data }); document.body.scrollTop = document.documentElement.scrollTop = 0; } diff --git a/src/app/contact/contact.page.ts b/src/app/contact/contact.page.ts index 1bbda3a..7ca366c 100644 --- a/src/app/contact/contact.page.ts +++ b/src/app/contact/contact.page.ts @@ -51,8 +51,12 @@ export class ContactPage implements OnInit { this.submitted = true; console.log(form.value); if (form.valid && form.value.message !== '') { - const contData = { ...this.contactData, from: this.userData.emailId }; - this.contactService.contactCreate(contData); + this.service.get('orderId').then((orderId) => { + const newOrder = orderId; + const contData = { ...this.contactData, from: this.userData.emailId, orderId: newOrder }; + this.contactService.contactCreate(contData); + }); + } else { console.log('form not valid'); this.submitted = false; diff --git a/src/app/delivery/delivery.page.scss b/src/app/delivery/delivery.page.scss index 7d71233..5e86ca3 100644 --- a/src/app/delivery/delivery.page.scss +++ b/src/app/delivery/delivery.page.scss @@ -117,7 +117,7 @@ p { margin: 0px; padding: 0px; - color: rgba(176, 174, 199); + color: rgb(176, 174, 199); } } } @@ -126,7 +126,7 @@ .product_detail { padding: 10px; hr { - border-bottom: 1px solid rgba(176, 174, 199); + border-bottom: 1px solid rgb(176, 174, 199); height: 0px; border-top: none; } diff --git a/src/app/deliverypop/deliverypop.page.scss b/src/app/deliverypop/deliverypop.page.scss index 7d71233..5e86ca3 100644 --- a/src/app/deliverypop/deliverypop.page.scss +++ b/src/app/deliverypop/deliverypop.page.scss @@ -117,7 +117,7 @@ p { margin: 0px; padding: 0px; - color: rgba(176, 174, 199); + color: rgb(176, 174, 199); } } } @@ -126,7 +126,7 @@ .product_detail { padding: 10px; hr { - border-bottom: 1px solid rgba(176, 174, 199); + border-bottom: 1px solid rgb(176, 174, 199); height: 0px; border-top: none; } diff --git a/src/app/firstpage/firstpage.page.ts b/src/app/firstpage/firstpage.page.ts index 967cc57..18a8dd9 100644 --- a/src/app/firstpage/firstpage.page.ts +++ b/src/app/firstpage/firstpage.page.ts @@ -22,13 +22,13 @@ export class FirstpagePage implements OnInit { console.log(user); if (user) { this.subjectService.sendLoginData(false); - this.goToPage('home'); + this.goToPage('home', { replaceUrl: true }); } else { this.subjectService.sendLoginData(true); - this.goToPage('login'); + this.goToPage('login', { replaceUrl: true }); } } else { - this.goToPage('landing'); + this.goToPage('landing', { replaceUrl: true }); } this.loader = false; }); diff --git a/src/app/home/home.page.scss b/src/app/home/home.page.scss index a8dd3a4..23f2d42 100644 --- a/src/app/home/home.page.scss +++ b/src/app/home/home.page.scss @@ -189,7 +189,7 @@ p { margin: 0px; padding: 0px; - color: rgba(176, 174, 199); + color: rgb(176, 174, 199); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index fd9be23..b74bcce 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -12,9 +12,11 @@ import { SubjectService } from './../../config/subject.service'; import { AddressService } from './../../config/address.service'; import { SearchService } from './../../config/search.service'; import { ProductsService } from './../../config/products.service'; + import { from } from 'rxjs'; import { ModalController } from '@ionic/angular'; import { SearchmodalPage } from '../searchmodal/searchmodal.page'; +import { AuthService } from 'src/config/auth.service'; @Component({ selector: 'app-home', @@ -41,6 +43,7 @@ export class HomePage implements OnInit { address: any; custId: any; private geoCoder; + subscription: any; slideOpts = { slidesPerView: 1.5 }; @@ -59,7 +62,8 @@ export class HomePage implements OnInit { private mapsAPILoader: MapsAPILoader, private searchService: SearchService, private productsService: ProductsService, - private subjectService: SubjectService + private subjectService: SubjectService, + private authService: AuthService ) { this.loader = false; } @@ -136,11 +140,20 @@ export class HomePage implements OnInit { ionViewWillEnter() { this.menuCtrl.enable(true); + this.authService.checkLogin(); } goToPage(path, data = null) { console.log(data); - this.service.set('params', data); + if (path === 'storelist') { + this.service.set('centerParams', data); + } else if (path === 'productlist') { + this.service.set('shopParams', data); + } else if (path === 'catstorelist') { + this.service.set('catParams', data); + } else { + + } this.router.navigateByUrl(path, { queryParams: data }); document.body.scrollTop = document.documentElement.scrollTop = 0; } @@ -161,11 +174,11 @@ export class HomePage implements OnInit { let url; if (datas.type === 'shopper') { data = datas.data; - this.service.set('params', data); + this.service.set('shopParams', data); url = 'productlist'; } else if (datas.type === 'category') { data = datas.data; - this.service.set('params', data); + this.service.set('catParams', data); url = 'catstorelist'; } else { data = datas.data; diff --git a/src/app/login/login.page.ts b/src/app/login/login.page.ts index 991d8bb..d886636 100644 --- a/src/app/login/login.page.ts +++ b/src/app/login/login.page.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; import { AuthService } from './../../config/auth.service'; -import { MenuController } from '@ionic/angular'; +import { MenuController, Platform } from '@ionic/angular'; import { async } from 'q'; @Component({ @@ -10,11 +10,13 @@ import { async } from 'q'; styleUrls: ['./login.page.scss'] }) export class LoginPage implements OnInit { + subscription: any; constructor( private router: Router, private route: ActivatedRoute, public authService: AuthService, - public menuCtrl: MenuController + public menuCtrl: MenuController, + private platform: Platform ) { } ngOnInit() { } @@ -23,6 +25,18 @@ export class LoginPage implements OnInit { this.menuCtrl.enable(false); } + ionViewDidEnter() { + this.subscription = this.platform.backButton.subscribe(() => { + console.log('cancelled'); + // tslint:disable-next-line:no-string-literal + navigator['app'].exitApp(); + }); + } + + ionViewWillLeave() { + this.subscription.unsubscribe(); + } + goToPage(path, data = null) { this.router.navigateByUrl(path, { replaceUrl: true, queryParams: data }); document.body.scrollTop = document.documentElement.scrollTop = 0; diff --git a/src/app/myorder/myorder.page.ts b/src/app/myorder/myorder.page.ts index 47e4c9e..8c8bba8 100644 --- a/src/app/myorder/myorder.page.ts +++ b/src/app/myorder/myorder.page.ts @@ -116,7 +116,8 @@ export class MyorderPage implements OnInit { } unEscape(text: string) { - return unescape(text); + const regex = '%uFFFD'; + return unescape(text.replace(/%uFFFD/g, '')); } } diff --git a/src/app/ordercancelled/ordercancelled.page.scss b/src/app/ordercancelled/ordercancelled.page.scss index 8cbc669..01fc7a1 100644 --- a/src/app/ordercancelled/ordercancelled.page.scss +++ b/src/app/ordercancelled/ordercancelled.page.scss @@ -114,7 +114,7 @@ p { margin: 0px; padding: 0px; - color: rgba(176, 174, 199); + color: rgb(176, 174, 199); } } } @@ -123,7 +123,7 @@ .product_detail { padding: 10px; hr { - border-bottom: 1px solid rgba(176, 174, 199); + border-bottom: 1px solid rgb(176, 174, 199); height: 0px; border-top: none; } diff --git a/src/app/orderplaced/orderplaced.page.html b/src/app/orderplaced/orderplaced.page.html index 8424246..817573d 100644 --- a/src/app/orderplaced/orderplaced.page.html +++ b/src/app/orderplaced/orderplaced.page.html @@ -106,7 +106,7 @@ {{data.deliveryAddress.building}}, <br /> {{data.deliveryAddress.landmark}} </h5> - <button class="cancel_btn" (click)="goToPage('contact')" + <button class="cancel_btn" (click)="cancelOrder(data.orderId)" *ngIf="cancelDelivery > 0 && data.orderStatus != 0 && data.orderStatus != 8"> CANCEL THIS ORDER </button> diff --git a/src/app/orderplaced/orderplaced.page.scss b/src/app/orderplaced/orderplaced.page.scss index 4aae6d9..04d8817 100644 --- a/src/app/orderplaced/orderplaced.page.scss +++ b/src/app/orderplaced/orderplaced.page.scss @@ -113,7 +113,7 @@ p { margin: 0px; padding: 0px; - color: rgba(176, 174, 199); + color: rgb(176, 174, 199); } } } @@ -122,7 +122,7 @@ .product_detail { padding: 10px; hr { - border-bottom: 1px solid rgba(176, 174, 199); + border-bottom: 1px solid rgb(176, 174, 199); height: 0px; border-top: none; } diff --git a/src/app/orderplaced/orderplaced.page.ts b/src/app/orderplaced/orderplaced.page.ts index a7996ee..ca5ebb7 100644 --- a/src/app/orderplaced/orderplaced.page.ts +++ b/src/app/orderplaced/orderplaced.page.ts @@ -42,7 +42,8 @@ export class OrderplacedPage implements OnInit { } unEscape(text: string) { - return unescape(text); + const regex = '%uFFFD'; + return unescape(text.replace(/%uFFFD/g, '')); } getDeliveryTime(timeStamp) { @@ -78,6 +79,11 @@ export class OrderplacedPage implements OnInit { document.body.scrollTop = document.documentElement.scrollTop = 0; } + cancelOrder(orderId) { + this.service.set('orderId', orderId); + this.router.navigateByUrl('contact'); + } + changeAddress(orderId) { this.service.set('orderId', orderId); this.router.navigateByUrl('changeaddress'); diff --git a/src/app/preference/preference.page.html b/src/app/preference/preference.page.html index 16a82db..7255841 100644 --- a/src/app/preference/preference.page.html +++ b/src/app/preference/preference.page.html @@ -1,7 +1,7 @@ <div class="nav_header"> - <button class="nav_btn nav_back floatLeft" (click)="goBack()" *ngIf="type==0"> - <img src="../assets/Group17_2.png" /> - </button> + <button class="nav_btn nav_back floatLeft" (click)="goBack()"> + <img src="../assets/Group17_2.png" /> + </button> <div class="nav_title floatLeft"> <h4>Preferences</h4> </div> @@ -15,8 +15,10 @@ <ion-row *ngIf="categoriesService.activecategories && categoriesService.activecategories.length > 0"> <ion-col size="6" *ngFor="let categories of categoriesService.categories"> <div class="preference-box"> - <input type="checkbox" class="preference" (click)="selectPrefernce(categories.catId)" [checked]="selectedPref(categories.catId)" /> - <img [src]="categories.catImage" onerror="this.src='../assets/handsome-man-outdoors-drinking-coffee-with-sunglasses-guy-with-beard-instagram-effect_1212-818@3x.png'" /> + <input type="checkbox" class="preference" (click)="selectPrefernce(categories.catId)" + [checked]="selectedPref(categories.catId)" /> + <img [src]="categories.catImage" + onerror="this.src='../assets/handsome-man-outdoors-drinking-coffee-with-sunglasses-guy-with-beard-instagram-effect_1212-818@3x.png'" /> <h1>{{categories.catName}}</h1> </div> </ion-col> @@ -29,8 +31,8 @@ <ion-footer> <div class="bottom-button"> <button class="show-btn" (click)="onSubmit()"> - Continue - </button> + Continue + </button> <!-- <span>SKIP</span> --> </div> </ion-footer> diff --git a/src/app/preference/preference.page.ts b/src/app/preference/preference.page.ts index daa96c6..488a1ff 100644 --- a/src/app/preference/preference.page.ts +++ b/src/app/preference/preference.page.ts @@ -46,7 +46,7 @@ export class PreferencePage implements OnInit { }); } - ngOnInit() {} + ngOnInit() { } selectPrefernce(preferenceId) { console.log(this.userPrefence); @@ -72,8 +72,8 @@ export class PreferencePage implements OnInit { setTimeout(() => { this.loader = false; this.successState = false; + this.service.set('type', 0); if (this.type === 1) { - this.service.set('type', 0); this.router.navigateByUrl('home', { queryParams: null }); } else { this.goBack(); diff --git a/src/app/productdetail/productdetail.page.ts b/src/app/productdetail/productdetail.page.ts index 12c7c07..22cd76a 100644 --- a/src/app/productdetail/productdetail.page.ts +++ b/src/app/productdetail/productdetail.page.ts @@ -75,7 +75,8 @@ export class ProductdetailPage implements OnInit { } unEscape(text: string) { - return unescape(text); + const regex = '%uFFFD'; + return unescape(text.replace(/%uFFFD/g, '')); } getProd(params) { diff --git a/src/app/productlist/productlist.page.ts b/src/app/productlist/productlist.page.ts index 6bb7da7..ed68b39 100644 --- a/src/app/productlist/productlist.page.ts +++ b/src/app/productlist/productlist.page.ts @@ -46,7 +46,7 @@ export class ProductlistPage implements OnInit { private subjectService: SubjectService ) { this.loader = true; - this.service.get('params').then(val => { + this.service.get('shopParams').then(val => { this.data = val; this.shopperId = this.data.uid; console.log(this.data); @@ -90,7 +90,8 @@ export class ProductlistPage implements OnInit { } unEscape(text: string) { - return unescape(text); + const regex = '%uFFFD'; + return unescape(text.replace(/%uFFFD/g, '')); } gridToggle() { @@ -158,11 +159,11 @@ export class ProductlistPage implements OnInit { let url; if (datas.type === 'shopper') { data = datas.data; - this.service.set('params', data); + this.service.set('shopParams', data); url = 'productlist'; } else if (datas.type === 'category') { data = datas.data; - this.service.set('params', data); + this.service.set('catParams', data); url = 'catstorelist'; } else { data = datas.data; diff --git a/src/app/profile/profile.page.html b/src/app/profile/profile.page.html index 2c5f175..9420c0d 100644 --- a/src/app/profile/profile.page.html +++ b/src/app/profile/profile.page.html @@ -18,7 +18,7 @@ <div class="profile_circle"> <img [src]="loggedUser.profilePhoto" onerror="this.src='./../assets/asset_avatar.png'" /> <div class="edit"></div> - <input type="file" accept="image/*" (change)="fileChange($event)" /> + <input type="file" accept="image/*;capture=camera" (change)="fileChange($event)" /> </div> <h5>{{loggedUser.name}}</h5> @@ -27,8 +27,8 @@ <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"> @@ -40,50 +40,56 @@ </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" (click)="goToPage('verficationnumber')">Not - Verified yet</span> - </ion-col> - </ion-row> - </div> - <div class="row"> - <ion-row> - <ion-col class="textLeft p0"> - <p> - Email - </p> - </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> - </ion-col> - </ion-row> - </div> - <hr /> - <ion-row (click)="goToPage('wishlist')"> - <ion-col class="textLeft p0"> - <p>Wishlist</p> - </ion-col> - <ion-col class="textRight p0"> - <h6 *ngIf="wishService.whishItem"> - ({{wishService.whishItem.length}}) - </h6> - </ion-col> - </ion-row> - <hr /> - <ion-row (click)="goToPage('address')"> - <ion-col class="textLeft p0"> - <p>Address</p> - </ion-col> - <ion-col class="textRight p0"> - <h6 *ngIf="addressService.addList"> - ({{addressService.addressList.length}}) - </h6> - </ion-col> - </ion-row> - <hr /> - <!-- <ion-row> + <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> + <div class="row"> + <ion-row> + <ion-col class="textLeft p0"> + <p> + Email + </p> + </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 + > + </ion-col> + </ion-row> + </div> + <hr /> + <ion-row (click)="goToPage('wishlist')"> + <ion-col class="textLeft p0"> + <p>Wishlist</p> + </ion-col> + <ion-col class="textRight p0"> + <h6 *ngIf="wishService.whishItem"> + ({{wishService.whishItem.length}}) + </h6> + </ion-col> + </ion-row> + <hr /> + <ion-row (click)="goToPage('address')"> + <ion-col class="textLeft p0"> + <p>Address</p> + </ion-col> + <ion-col class="textRight p0"> + <h6 *ngIf="addressService.addList"> + ({{addressService.addressList.length}}) + </h6> + </ion-col> + </ion-row> + <hr /> + <!-- <ion-row> <ion-col class="textLeft p0"> <p>My Cards</p> </ion-col> @@ -94,56 +100,56 @@ </ion-col> </ion-row> <hr /> --> - <ion-row (click)="goToPage('myorder')"> - <ion-col class="textLeft p0"> - <p>My Order</p> - </ion-col> - <ion-col class="textRight p0"> - <h6> - <ion-icon name="arrow-forward"></ion-icon> - </h6> - </ion-col> - </ion-row> - <hr /> - <ion-row (click)="goToPage('preference')"> - <ion-col class="textLeft p0"> - <p>Preferences</p> - </ion-col> - <ion-col class="textRight p0"> - <h6> - <ion-icon name="arrow-forward"></ion-icon> - </h6> - </ion-col> - </ion-row> - <hr /> - <ion-row> - <ion-col class="textLeft p0"> - <p>Currency</p> - </ion-col> - <ion-col class="textRight p0"> - <h6> - <span>AUD</span> - </h6> - </ion-col> - </ion-row> - </div> - <div class="logout-pop-wrapper" *ngIf="isShow" [@slideInOut]> - <div class="logout_inner"> - <h4>Logout</h4> - <p>Are you sure to Logout ?</p> - <div class="logout_footer"> - <button class="btn-cancel floatLeft" (click)="istoggle();"> - Cancel - </button> - <button class="btn-logout floatRight" (click)="authService.SignOut(); istoggle()"> - Logout - </button> - </div> + <ion-row (click)="goToPage('myorder')"> + <ion-col class="textLeft p0"> + <p>My Order</p> + </ion-col> + <ion-col class="textRight p0"> + <h6> + <ion-icon name="arrow-forward"></ion-icon> + </h6> + </ion-col> + </ion-row> + <hr /> + <ion-row (click)="goToPage('preference')"> + <ion-col class="textLeft p0"> + <p>Preferences</p> + </ion-col> + <ion-col class="textRight p0"> + <h6> + <ion-icon name="arrow-forward"></ion-icon> + </h6> + </ion-col> + </ion-row> + <hr /> + <ion-row> + <ion-col class="textLeft p0"> + <p>Currency</p> + </ion-col> + <ion-col class="textRight p0"> + <h6> + <span>AUD</span> + </h6> + </ion-col> + </ion-row> + </div> + <div class="logout-pop-wrapper" *ngIf="isShow" [@slideInOut]> + <div class="logout_inner"> + <h4>Logout</h4> + <p>Are you sure to Logout ?</p> + <div class="logout_footer"> + <button class="btn-cancel floatLeft" (click)="istoggle();"> + Cancel + </button> + <button class="btn-logout floatRight" (click)="authService.SignOut(); istoggle()"> + Logout + </button> + </div> - <div class="clear"></div> + <div class="clear"></div> + </div> </div> </div> - </div> </ion-content> <div class="loader" *ngIf="loader"> <div class="lds-ripple"> diff --git a/src/app/profile/profile.page.ts b/src/app/profile/profile.page.ts index 8c2551a..06a259d 100644 --- a/src/app/profile/profile.page.ts +++ b/src/app/profile/profile.page.ts @@ -80,6 +80,10 @@ export class ProfilePage implements OnInit { document.body.scrollTop = document.documentElement.scrollTop = 0; } + ionViewWillEnter() { + this.authService.checkLogin(); + } + ngOnInit() { console.log('profile page'); const This = this; diff --git a/src/app/review/review.page.scss b/src/app/review/review.page.scss index 056cae8..f240135 100644 --- a/src/app/review/review.page.scss +++ b/src/app/review/review.page.scss @@ -35,7 +35,7 @@ p { margin: 0px; padding: 0px; - color: rgba(176, 174, 199); + color: rgb(176, 174, 199); img { width: 16px; } diff --git a/src/app/reviewlist/reviewlist.page.scss b/src/app/reviewlist/reviewlist.page.scss index 396ad9e..8e8aa6f 100644 --- a/src/app/reviewlist/reviewlist.page.scss +++ b/src/app/reviewlist/reviewlist.page.scss @@ -37,7 +37,7 @@ p { margin: 0px; padding: 0px; - color: rgba(176, 174, 199); + color: rgb(176, 174, 199); } } } diff --git a/src/app/searchmodal/searchmodal.page.ts b/src/app/searchmodal/searchmodal.page.ts index 0187753..4ae39e3 100644 --- a/src/app/searchmodal/searchmodal.page.ts +++ b/src/app/searchmodal/searchmodal.page.ts @@ -46,11 +46,11 @@ export class SearchmodalPage implements OnInit { let url; if (datas.type === 'shopper') { data = datas.data; - this.service.set('params', data); + this.service.set('shopParams', data); url = 'productlist'; } else if (datas.type === 'category') { data = datas.data; - this.service.set('params', data); + this.service.set('catParams', data); url = 'catstorelist'; } else { data = datas.data; @@ -60,7 +60,7 @@ export class SearchmodalPage implements OnInit { this.productsService.setProd(data); } this.searchClose(); - this.router.navigateByUrl(url, { queryParams: data }); + this.router.navigateByUrl(url, { queryParams: data, skipLocationChange: true }); document.body.scrollTop = document.documentElement.scrollTop = 0; } @@ -70,7 +70,8 @@ export class SearchmodalPage implements OnInit { } unEscape(text: string) { - return unescape(text); + const respVal = unescape(text); + return respVal.replace('�', ''); } diff --git a/src/app/storelist/storelist.page.scss b/src/app/storelist/storelist.page.scss index 79b1809..5c0236e 100644 --- a/src/app/storelist/storelist.page.scss +++ b/src/app/storelist/storelist.page.scss @@ -175,7 +175,7 @@ p { margin: 0px; padding: 0px; - color: rgba(176, 174, 199); + color: rgb(176, 174, 199); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; diff --git a/src/app/storelist/storelist.page.ts b/src/app/storelist/storelist.page.ts index d759e5e..5ee969d 100644 --- a/src/app/storelist/storelist.page.ts +++ b/src/app/storelist/storelist.page.ts @@ -43,7 +43,7 @@ export class StorelistPage implements OnInit { private subjectService: SubjectService ) { this.loader = true; - this.service.get('params').then(val => { + this.service.get('centerParams').then(val => { this.data = val; this.centerId = this.data.cId; this.shopperService.shopperList(this.data.cId, 'centerId'); @@ -53,10 +53,10 @@ export class StorelistPage implements OnInit { }); } - ngOnInit() {} + ngOnInit() { } goToPage(path, data = null) { - this.service.set('params', data); + this.service.set('shopParams', data); this.router.navigateByUrl(path, { queryParams: data }); document.body.scrollTop = document.documentElement.scrollTop = 0; } diff --git a/src/app/wishlist/wishlist.page.html b/src/app/wishlist/wishlist.page.html index 5d5e8dd..941d04f 100644 --- a/src/app/wishlist/wishlist.page.html +++ b/src/app/wishlist/wishlist.page.html @@ -13,26 +13,15 @@ <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'" - /> + <img [src]="product.image" onerror="this.src='../../assets/img-list.png'" /> </div> <div class="wishlist_detail"> - <p class="floatLeft" (click)="prodDetails(i)">{{product.prodName}}</p> - <span class="floatRight" - ><img - src="../../assets/heart.png" - (click)="removeItem(product.prodId)" - /></span> + <p class="floatLeft" (click)="prodDetails(i)">{{unEscape(product.prodName)}}</p> + <span class="floatRight"><img src="../../assets/heart.png" (click)="removeItem(product.prodId)" /></span> <div class="clear"></div> <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 - > + <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> @@ -46,14 +35,19 @@ <button (click)="goToPage('home')">shop now</button> </div> + +</ion-content> + +<ion-footer> <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> +</ion-footer> + <div class="loader" *ngIf="loader"> <div class="lds-ripple"> <div></div> <div></div> </div> -</div> +</div> \ No newline at end of file diff --git a/src/app/wishlist/wishlist.page.scss b/src/app/wishlist/wishlist.page.scss index c22a6aa..c68c439 100644 --- a/src/app/wishlist/wishlist.page.scss +++ b/src/app/wishlist/wishlist.page.scss @@ -31,7 +31,7 @@ p { margin: 0px; padding: 0px; - color: rgba(176, 174, 199); + color: rgb(176, 174, 199); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; diff --git a/src/app/wishlist/wishlist.page.ts b/src/app/wishlist/wishlist.page.ts index ce27aaa..3df8622 100644 --- a/src/app/wishlist/wishlist.page.ts +++ b/src/app/wishlist/wishlist.page.ts @@ -33,7 +33,7 @@ export class WishlistPage implements OnInit { }); } - ngOnInit() {} + ngOnInit() { } goBack() { this.location.back(); @@ -58,31 +58,53 @@ export class WishlistPage implements OnInit { }); } - addToCart() { + async 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); - }); + let centerId = ''; + let state = false; + await this.wishService.whishItem.forEach((item) => { + if (centerId === '') { + centerId = item.centerId; + } else { + if (centerId !== item.centerId) { + state = true; + } + } + }); + + if (state === false) { + 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); + }); + } else { + this.loader = false; + this.service.showToast('You have selected products from different shopping centers', 'top', 'my-error', 2000); + } + } + + unEscape(text: string) { + const regex = '%uFFFD'; + return unescape(text.replace(/%uFFFD/g, '')); } removeItem(prodId) { diff --git a/src/assets/asset_avatar.png b/src/assets/asset_avatar.png index a9e3271..3365f2f 100644 Binary files a/src/assets/asset_avatar.png and b/src/assets/asset_avatar.png differ diff --git a/src/assets/cart.png b/src/assets/cart.png new file mode 100644 index 0000000..25dbdd7 Binary files /dev/null and b/src/assets/cart.png differ diff --git a/src/assets/img-list.png b/src/assets/img-list.png index 481530b..5608b8d 100644 Binary files a/src/assets/img-list.png and b/src/assets/img-list.png differ diff --git a/src/assets/model1@3x.jpg b/src/assets/model1@3x.jpg deleted file mode 100644 index 6f2dd91..0000000 Binary files a/src/assets/model1@3x.jpg and /dev/null differ diff --git a/src/assets/model1@3x.png b/src/assets/model1@3x.png index ed9ea70..0a65743 100644 Binary files a/src/assets/model1@3x.png and b/src/assets/model1@3x.png differ diff --git a/src/assets/model1_3x.png b/src/assets/model1_3x.png new file mode 100644 index 0000000..161ee16 Binary files /dev/null and b/src/assets/model1_3x.png differ diff --git a/src/config/address.service.ts b/src/config/address.service.ts index 21839a1..68d317d 100644 --- a/src/config/address.service.ts +++ b/src/config/address.service.ts @@ -55,7 +55,6 @@ export class AddressService { ref => ref.where('status', '==', state).where('uid', '==', userId).where('defaultVal', '==', 1) ); orderRef.valueChanges().subscribe(value => { - this.addressList = []; const res = value; if (res.length > 0) { const item = res[0]; diff --git a/src/config/auth.service.ts b/src/config/auth.service.ts index 3213b2c..c7b0b87 100644 --- a/src/config/auth.service.ts +++ b/src/config/auth.service.ts @@ -40,7 +40,7 @@ export class AuthService { this.SetUserData(user); this.loader = false; if (this.type === 1) { - this.router.navigateByUrl('home'); + this.router.navigateByUrl('home', { replaceUrl: true }); } else { this.router.navigateByUrl('verification'); } @@ -50,7 +50,15 @@ export class AuthService { this.subjectService.sendLoginData(true); this.service.set('user', null); JSON.parse(localStorage.getItem('user')); - this.router.navigateByUrl('login'); + this.router.navigateByUrl('login', { replaceUrl: true }); + } + }); + } + + checkLogin() { + this.afAuth.authState.subscribe(user => { + if (!user) { + this.router.navigateByUrl('login', { replaceUrl: true }); } }); } @@ -325,7 +333,7 @@ export class AuthService { .then(() => { console.log('Address add Successfully'); this.service.set('user', JSON.stringify(this.userData)); - this.router.navigateByUrl('home'); + this.router.navigateByUrl('home', { replaceUrl: true }); document.body.scrollTop = document.documentElement.scrollTop = 0; }) .catch(err => { @@ -342,7 +350,7 @@ export class AuthService { .then(() => { this.service.showToast('Password reset mail has been sent your mail Id', 'top', 'my-toast', 2000); this.loader = false; - this.router.navigateByUrl('login'); + this.router.navigateByUrl('login', { replaceUrl: true }); }) .catch((error) => { this.service.showToast(error, 'top', 'my-error', 1000); diff --git a/src/config/contact.service.ts b/src/config/contact.service.ts index 1e55888..b62b5a5 100644 --- a/src/config/contact.service.ts +++ b/src/config/contact.service.ts @@ -25,13 +25,13 @@ export class ContactService { this.loader = true; this.afs .collection('contacts') - .add({}) + .add(data) .then(docRef => { data.contactId = docRef.id; this.afs .collection('contacts') .doc(data.contactId) - .set(data) + .update({ contactId: data.contactId }) .then(() => { this.service .showToast('Thank you for your feedback!', 'top', 'my-toast', 500) diff --git a/src/config/order.service.ts b/src/config/order.service.ts index c86b33f..beaf13a 100644 --- a/src/config/order.service.ts +++ b/src/config/order.service.ts @@ -134,74 +134,72 @@ export class OrdersService { const promise = new Promise(resolve => { distinctShops.forEach(item => { console.log(item); + + const pickup = new firebase.firestore.GeoPoint(10.7231, 76.1234); + const products = {}; + const cartItem = cartGroup[item]; + let prodPrice = 0; + cartItem.forEach(prodItem => { + prodPrice += prodItem.price; + products[prodItem.prodId] = { + prodId: prodItem.prodId, + prodName: prodItem.prodName, + image: prodItem.image, + price: prodItem.price, + color: prodItem.color, + size: prodItem.size, + qty: prodItem.qty, + discount: '' + }; + this.afs.doc(`carts/${prodItem.cartId}`).delete(); + }); + // console.log(cartItem); + // console.log(products); + const product = cartItem[0]; + this.custId = this.custId.trim(); + const orderItem: Order = { + amount: 'A$ ' + otherCharge.totalAmt, + customer: firebase.firestore().doc('/customer/' + this.custId), + shopper: product.shopper, + deliveryAddress: otherCharge.custAddress, + deliveryCharge: 'A$ ' + otherCharge.deliveryCharge, + deliveryLocation: otherCharge.custAddress.latLng, + bookDate: firebase.firestore.FieldValue.serverTimestamp(), + orderDate: Math.floor(Date.now() / 1000), + orderCode: this.orderCode(), + orderId: '', + orderStatus: 1, + pickupAddress: '', + pickupLocation: pickup, + promoId: null, + rider: firebase + .firestore() + .doc('/riders/qbTKza18mWVzYG9NLIbmjMbrYjG2'), + status: 1, + custId: this.custId, + riderId: 'qbTKza18mWVzYG9NLIbmjMbrYjG2', + shopperId: product.shopperId, + custName: 'Customer', + riderName: 'John', + shopperState: 0, + paymentMethod: otherCharge.paymentMethod, + shopperName: '', + product: products, + discount: 'A$ ' + otherCharge.discount, + promoApplied: otherCharge.discountApplied, + tax: 'A$ ' + otherCharge.taxAmount + }; + // console.log(orderItem); + this.afs .collection('orders') - .add({ - shopper: firebase.firestore().doc('/shoppers/' + item), - bookDate: firebase.firestore.FieldValue.serverTimestamp() - }) + .add(orderItem) .then(docRef => { const neworderId = docRef.id; - const pickup = new firebase.firestore.GeoPoint(10.7231, 76.1234); - const products = {}; - const cartItem = cartGroup[item]; - let prodPrice = 0; - cartItem.forEach(prodItem => { - prodPrice += prodItem.price; - products[prodItem.prodId] = { - prodId: prodItem.prodId, - prodName: prodItem.prodName, - image: prodItem.image, - price: prodItem.price, - color: prodItem.color, - size: prodItem.size, - qty: prodItem.qty, - discount: '' - }; - this.afs.doc(`carts/${prodItem.cartId}`).delete(); - }); - // console.log(cartItem); - // console.log(products); - const product = cartItem[0]; - this.custId = this.custId.trim(); - const orderItem: Order = { - amount: 'A$ ' + otherCharge.totalAmt, - customer: firebase.firestore().doc('/customer/' + this.custId), - shopper: product.shopper, - deliveryAddress: otherCharge.custAddress, - deliveryCharge: 'A$ ' + otherCharge.deliveryCharge, - deliveryLocation: otherCharge.custAddress.latLng, - bookDate: firebase.firestore.FieldValue.serverTimestamp(), - orderDate: Math.floor(Date.now() / 1000), - orderCode: this.orderCode(), - orderId: neworderId, - orderStatus: 1, - pickupAddress: '', - pickupLocation: pickup, - promoId: null, - rider: firebase - .firestore() - .doc('/riders/qbTKza18mWVzYG9NLIbmjMbrYjG2'), - status: 1, - custId: this.custId, - riderId: 'qbTKza18mWVzYG9NLIbmjMbrYjG2', - shopperId: product.shopperId, - custName: 'Customer', - riderName: 'John', - shopperState: 0, - paymentMethod: otherCharge.paymentMethod, - shopperName: '', - product: products, - discount: 'A$ ' + otherCharge.discount, - promoApplied: otherCharge.discountApplied, - tax: 'A$ ' + otherCharge.taxAmount - }; - // console.log(orderItem); - this.afs .collection('orders') .doc(neworderId) - .set(orderItem) + .update({ orderId: neworderId }) .then(() => { // console.log('Booking Successfully'); // this.router.navigateByUrl('cart'); @@ -209,8 +207,7 @@ export class OrdersService { resolve('Cart to Order Successfully'); document.body.scrollTop = document.documentElement.scrollTop = 0; }); - }) - .catch(error => { + }).catch(error => { console.error('Error adding document: ', error); }); }); diff --git a/src/global.scss b/src/global.scss index 79227f6..5f15bea 100644 --- a/src/global.scss +++ b/src/global.scss @@ -453,7 +453,7 @@ app-success { .not { background-color: #3b394d; color: #fff; - width: 17px; + min-width: 17px; height: 17px; border-radius: 50%; position: absolute;