Commit 645657c4 by muhsin

fixed search clear issue

parent 17b9765f
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<ion-content> <ion-content>
<div class="side_menu_wrapper"> <div class="side_menu_wrapper">
<ion-menu-toggle> <ion-menu-toggle>
<div class="top_banner"> <div class="top_banner" (click)="goToPage('profile')">
<div class="top_image"></div> <div class="top_image"></div>
<div class="top_detail"> <div class="top_detail">
<h4>John Doe</h4> <h4>John Doe</h4>
......
import { Component } from '@angular/core'; import { Component } from "@angular/core";
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from "@angular/router";
import { Platform } from '@ionic/angular'; import { Platform } from "@ionic/angular";
import { SplashScreen } from '@ionic-native/splash-screen/ngx'; import { SplashScreen } from "@ionic-native/splash-screen/ngx";
import { StatusBar } from '@ionic-native/status-bar/ngx'; import { StatusBar } from "@ionic-native/status-bar/ngx";
import { AngularFirestore, AngularFirestoreDocument, AngularFirestoreCollection } from '@angular/fire/firestore'; import {
import * as firebase from 'firebase'; AngularFirestore,
import { ModalController } from '@ionic/angular'; AngularFirestoreDocument,
import { DeliverypopPage } from './deliverypop/deliverypop.page'; AngularFirestoreCollection
import { AuthService } from './../config/auth.service'; } from "@angular/fire/firestore";
import { ServiceService } from './../config/service.service'; import * as firebase from "firebase";
import { CategoriesService } from './../config/category.service'; 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";
@Component({ @Component({
selector: "app-root", selector: "app-root",
templateUrl: "app.component.html", templateUrl: "app.component.html",
...@@ -25,6 +29,9 @@ export class AppComponent { ...@@ -25,6 +29,9 @@ export class AppComponent {
sec_active5 = false; sec_active5 = false;
sec_active6 = false; sec_active6 = false;
// Customer Info
user: User;
menuw: number; menuw: number;
constructor( constructor(
...@@ -37,10 +44,20 @@ export class AppComponent { ...@@ -37,10 +44,20 @@ export class AppComponent {
public authService: AuthService, public authService: AuthService,
public service: ServiceService, public service: ServiceService,
public categoryService: CategoriesService, public categoryService: CategoriesService,
private route: ActivatedRoute private route: ActivatedRoute,
private useService: UserService
) { ) {
this.initializeApp(); this.initializeApp();
this.orderState(); this.orderState();
const userdata = this.service.get("user").then(data => {
if (data) {
data = JSON.parse(data);
console.log(data);
}
});
this.useService.getUserData("9cYSZwGvVpgkUHVcz8Dm6oqGX152");
} }
initializeApp() { initializeApp() {
...@@ -48,7 +65,7 @@ export class AppComponent { ...@@ -48,7 +65,7 @@ export class AppComponent {
this.statusBar.styleDefault(); this.statusBar.styleDefault();
this.statusBar.overlaysWebView(false); this.statusBar.overlaysWebView(false);
this.statusBar.show(); this.statusBar.show();
this.statusBar.backgroundColorByHexString('#29285b'); this.statusBar.backgroundColorByHexString("#29285b");
}); });
} }
...@@ -60,6 +77,13 @@ export class AppComponent { ...@@ -60,6 +77,13 @@ export class AppComponent {
return await modal.present(); return await modal.present();
} }
ngOnInit() {
let This = this;
setTimeout(() => {
this.user = this.useService.users;
console.log("[usersaaa]", this.user);
}, 500);
}
goToPage(path, data = null) { goToPage(path, data = null) {
this.service.set("params", data); this.service.set("params", data);
this.router.navigateByUrl(path, { queryParams: data }); this.router.navigateByUrl(path, { queryParams: data });
......
...@@ -3,6 +3,7 @@ import { Router } from "@angular/router"; ...@@ -3,6 +3,7 @@ import { Router } from "@angular/router";
import { Location } from "@angular/common"; import { Location } from "@angular/common";
import { ServiceService } from "./../../config/service.service"; import { ServiceService } from "./../../config/service.service";
import { ShoppersService } from "./../../config/shopper.service"; import { ShoppersService } from "./../../config/shopper.service";
import { SearchService } from "../../config/search.service";
import { trigger, transition, animate, style } from "@angular/animations"; import { trigger, transition, animate, style } from "@angular/animations";
@Component({ @Component({
...@@ -28,19 +29,12 @@ export class CatStorelistPage implements OnInit { ...@@ -28,19 +29,12 @@ export class CatStorelistPage implements OnInit {
}; };
data: any; data: any;
clickSearch() {
this.searchShow = true;
}
searchClose() {
this.searchShow = false;
}
constructor( constructor(
public router: Router, public router: Router,
public location: Location, public location: Location,
public service: ServiceService, public service: ServiceService,
public shopperService: ShoppersService public shopperService: ShoppersService,
private searchService: SearchService
) { ) {
this.service.get("params").then(val => { this.service.get("params").then(val => {
this.data = val; this.data = val;
...@@ -48,6 +42,14 @@ export class CatStorelistPage implements OnInit { ...@@ -48,6 +42,14 @@ export class CatStorelistPage implements OnInit {
}); });
} }
clickSearch() {
this.searchShow = true;
this.searchService.searchList = [];
}
searchClose() {
this.searchShow = false;
}
ngOnInit() {} ngOnInit() {}
goToPage(path, data = null) { goToPage(path, data = null) {
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { Location } from '@angular/common'; import { Location } from "@angular/common";
import { trigger, transition, animate, style } from '@angular/animations'; import { trigger, transition, animate, style } from "@angular/animations";
import { Router, ActivatedRoute, NavigationExtras } from '@angular/router'; import { Router, ActivatedRoute, NavigationExtras } from "@angular/router";
import { ProductsService } from './../../config/products.service'; import { ProductsService } from "./../../config/products.service";
import { ServiceService } from './../../config/service.service'; import { ServiceService } from "./../../config/service.service";
import { SearchService } from './../../config/search.service'; import { SearchService } from "./../../config/search.service";
@Component({ @Component({
selector: 'app-productlist', selector: "app-productlist",
templateUrl: './productlist.page.html', templateUrl: "./productlist.page.html",
styleUrls: ['./productlist.page.scss'], styleUrls: ["./productlist.page.scss"],
animations: [ animations: [
trigger('slideInOut', [ trigger("slideInOut", [
transition(':enter', [ transition(":enter", [
style({ transform: 'translateY(100%)' }), style({ transform: "translateY(100%)" }),
animate('200ms ease-in', style({ transform: 'translateY(0%)' })) animate("200ms ease-in", style({ transform: "translateY(0%)" }))
]), ]),
transition(':leave', [ transition(":leave", [
animate('200ms ease-out', style({ transform: 'translateY(100%)' })) animate("200ms ease-out", style({ transform: "translateY(100%)" }))
]) ])
]) ])
] ]
...@@ -37,7 +37,7 @@ export class ProductlistPage implements OnInit { ...@@ -37,7 +37,7 @@ export class ProductlistPage implements OnInit {
public service: ServiceService, public service: ServiceService,
public searchService: SearchService public searchService: SearchService
) { ) {
this.service.get('params').then(val => { this.service.get("params").then(val => {
this.data = val; this.data = val;
console.log(this.data); console.log(this.data);
this.prodService.prodList(this.data.uid); this.prodService.prodList(this.data.uid);
...@@ -66,6 +66,7 @@ export class ProductlistPage implements OnInit { ...@@ -66,6 +66,7 @@ export class ProductlistPage implements OnInit {
clickSearch() { clickSearch() {
this.searchShow = true; this.searchShow = true;
this.searchService.searchList = [];
} }
searchClose() { searchClose() {
...@@ -74,7 +75,7 @@ export class ProductlistPage implements OnInit { ...@@ -74,7 +75,7 @@ export class ProductlistPage implements OnInit {
prodDetails(index: number) { prodDetails(index: number) {
this.prodService.setProd(this.prodService.product[index]); this.prodService.setProd(this.prodService.product[index]);
this.router.navigateByUrl('productdetail'); this.router.navigateByUrl("productdetail");
document.body.scrollTop = document.documentElement.scrollTop = 0; document.body.scrollTop = document.documentElement.scrollTop = 0;
} }
...@@ -84,10 +85,10 @@ export class ProductlistPage implements OnInit { ...@@ -84,10 +85,10 @@ export class ProductlistPage implements OnInit {
console.log(this.prodService.fav); console.log(this.prodService.fav);
if (state > -1) { if (state > -1) {
this.prodService.fav.splice(state, 1); this.prodService.fav.splice(state, 1);
this.prodService.changeFav(index, 'yes'); this.prodService.changeFav(index, "yes");
} else { } else {
this.prodService.fav.push(index); this.prodService.fav.push(index);
this.prodService.changeFav(index, 'no'); this.prodService.changeFav(index, "no");
} }
return; return;
console.log(this.prodService.fav); console.log(this.prodService.fav);
...@@ -105,7 +106,7 @@ export class ProductlistPage implements OnInit { ...@@ -105,7 +106,7 @@ export class ProductlistPage implements OnInit {
checkFavStatus(index) { checkFavStatus(index) {
const state = this.prodService.fav.findIndex(x => x === index); const state = this.prodService.fav.findIndex(x => x === index);
return state > -1 ? 'fav_fill' : 'fav_icon'; return state > -1 ? "fav_fill" : "fav_icon";
} }
searchFun(data: string) { searchFun(data: string) {
...@@ -116,19 +117,19 @@ export class ProductlistPage implements OnInit { ...@@ -116,19 +117,19 @@ export class ProductlistPage implements OnInit {
console.log(datas); console.log(datas);
let data; let data;
let url; let url;
if (datas.type === 'shopper') { if (datas.type === "shopper") {
data = datas.data; data = datas.data;
this.service.set('params', data); this.service.set("params", data);
url = 'productlist'; url = "productlist";
} else if (datas.type === 'category') { } else if (datas.type === "category") {
data = datas.data; data = datas.data;
this.service.set('params', data); this.service.set("params", data);
url = 'catstorelist'; url = "catstorelist";
} else { } else {
data = datas.data; data = datas.data;
data.size = this.service.splitSep(data.size); data.size = this.service.splitSep(data.size);
data.tag = this.service.splitSep(data.tag); data.tag = this.service.splitSep(data.tag);
(data.color = this.service.splitSep(data.color)), (url = 'productdetail'); (data.color = this.service.splitSep(data.color)), (url = "productdetail");
this.prodService.setProd(data); this.prodService.setProd(data);
} }
this.searchClose(); this.searchClose();
......
...@@ -4,7 +4,7 @@ import { Router } from "@angular/router"; ...@@ -4,7 +4,7 @@ import { Router } from "@angular/router";
import { Location } from "@angular/common"; import { Location } from "@angular/common";
import { ServiceService } from "./../../config/service.service"; import { ServiceService } from "./../../config/service.service";
import { ShoppersService } from "./../../config/shopper.service"; import { ShoppersService } from "./../../config/shopper.service";
import { SearchService } from "../../config/search.service";
@Component({ @Component({
selector: "app-storelist", selector: "app-storelist",
templateUrl: "./storelist.page.html", templateUrl: "./storelist.page.html",
...@@ -32,7 +32,8 @@ export class StorelistPage implements OnInit { ...@@ -32,7 +32,8 @@ export class StorelistPage implements OnInit {
public router: Router, public router: Router,
public location: Location, public location: Location,
public service: ServiceService, public service: ServiceService,
public shopperService: ShoppersService public shopperService: ShoppersService,
private searchService: SearchService
) { ) {
this.service.get("params").then(val => { this.service.get("params").then(val => {
this.data = val; this.data = val;
...@@ -54,6 +55,7 @@ export class StorelistPage implements OnInit { ...@@ -54,6 +55,7 @@ export class StorelistPage implements OnInit {
clickSearch() { clickSearch() {
this.searchShow = true; this.searchShow = true;
this.searchService.searchList = [];
} }
searchClose() { searchClose() {
......
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