Commit 5690c8d0 by Arjun

Merge branch 'master' of https://gitlab.techware.co.in/amal/getme into arjun

parents b09e2d18 17b9765f
{
"name": "css-bundle",
"version": "1.0.0",
"description": "Simple node project to run stylelint from SonarCSS",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "LGPL-3.0",
"dependencies": {
"stylelint": "10.1.0"
}
}
{"rules":{"block-no-empty":true,"string-no-newline":true,"comment-no-empty":true,"function-linear-gradient-no-nonstandard-direction":true,"media-feature-name-no-unknown":true,"color-no-invalid-hex":true,"font-family-no-duplicate-names":true,"no-duplicate-at-import-rules":true,"no-empty-source":true,"declaration-block-no-duplicate-properties":[true,{"ignore":["consecutive-duplicates-with-different-values"]}],"selector-type-no-unknown":[true,{"ignoreTypes":["/^mat-/"]}],"at-rule-no-unknown":[true,{"ignoreAtRules":["value","at-root","content","debug","each","else","error","for","function","if","include","mixin","return","warn","while","extend"]}],"no-duplicate-selectors":true,"font-family-no-missing-generic-family-keyword":true,"no-extra-semicolons":true,"no-invalid-double-slash-comments":true,"selector-pseudo-element-no-unknown":true,"selector-pseudo-class-no-unknown":[true,{"ignorePseudoClasses":["local","global","export","import"]}],"keyframe-declaration-no-important":true,"function-calc-no-unspaced-operator":true,"property-no-unknown":[true,{"ignoreProperties":["composes","exportedKey","localAlias"]}],"declaration-block-no-shorthand-property-overrides":true,"unit-no-unknown":[true,{"ignoreUnits":["x"]}]}}
projectKey=GetmiUser
serverUrl=http://sonarqube.techlabz.in
serverVersion=7.9.2.30863
dashboardUrl=http://sonarqube.techlabz.in/dashboard?id=GetmiUser
ceTaskId=AW_wM7iyfQ91M3jwRMen
ceTaskUrl=http://sonarqube.techlabz.in/api/ce/task?id=AW_wM7iyfQ91M3jwRMen
......@@ -13,41 +13,41 @@
},
"private": true,
"dependencies": {
"@agm/core": "^1.0.0-beta.7",
"@angular/animations": "^8.2.11",
"@agm/core": "^1.1.0",
"@angular/animations": "^8.2.14",
"@angular/common": "~8.1.2",
"@angular/compiler": "~8.1.2",
"@angular/core": "~8.1.2",
"@angular/fire": "^5.2.1",
"@angular/fire": "^5.3.0",
"@angular/forms": "~8.1.2",
"@angular/platform-browser": "~8.1.2",
"@angular/platform-browser-dynamic": "~8.1.2",
"@angular/router": "~8.1.2",
"@ionic-native/core": "^5.0.0",
"@ionic-native/geolocation": "^5.15.1",
"@ionic-native/google-plus": "^5.0.0-beta.0",
"@ionic-native/native-geocoder": "^5.15.1",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.12.0",
"@ionic/angular": "^4.7.1",
"@ionic-native/core": "^5.19.1",
"@ionic-native/geolocation": "^5.19.1",
"@ionic-native/google-plus": "^5.19.1",
"@ionic-native/native-geocoder": "^5.19.1",
"@ionic-native/splash-screen": "^5.19.1",
"@ionic-native/status-bar": "^5.19.1",
"@ionic/angular": "^4.11.8",
"@ionic/storage": "^2.2.0",
"@types/googlemaps": "^3.38.0",
"agm-direction": "^0.7.8",
"@types/googlemaps": "^3.39.2",
"agm-direction": "^0.7.9",
"cordova-android": "8.0.0",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-geolocation": "^4.0.2",
"cordova-plugin-googleplus": "^8.2.0",
"cordova-plugin-googleplus": "^8.2.1",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^4.1.3",
"cordova-plugin-nativegeocoder": "^3.2.2",
"cordova-plugin-splashscreen": "^5.0.3",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-sqlite-storage": "^3.4.0",
"core-js": "^2.5.4",
"firebase": "^6.4.0",
"rxjs": "~6.5.1",
"rxjs-compat": "^6.5.3",
"cordova-sqlite-storage": "^3.4.1",
"core-js": "^2.6.11",
"firebase": "^6.6.2",
"rxjs": "^6.5.4",
"rxjs-compat": "^6.5.4",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
......@@ -62,16 +62,16 @@
"@angular/language-service": "~8.1.2",
"@ionic/angular-toolkit": "~2.0.0",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/jasminewd2": "^2.0.8",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"codelyzer": "^5.2.1",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"karma-jasmine-html-reporter": "^1.5.1",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
......
<ion-app>
<ion-split-pane>
<ion-menu>
<ion-content>
<div class="side_menu_wrapper">
<ion-menu-toggle>
<div class="top_banner">
<div class="top_image">
<ion-split-pane>
<ion-menu>
<ion-content>
<div class="side_menu_wrapper">
<ion-menu-toggle>
<div class="top_banner">
<div class="top_image"></div>
<div class="top_detail">
<h4>John Doe</h4>
<p>[email protected]</p>
</div>
<div class="clear"></div>
</div>
</ion-menu-toggle>
<div class="sidemenu_list">
<ul>
<ion-menu-toggle>
<li (click)="vieworder('home')">Shop</li>
</ion-menu-toggle>
<li>About us</li>
<ion-menu-toggle>
<li (click)="vieworder('myorder')">View Order</li>
</ion-menu-toggle>
</div>
<div class="top_detail" >
<h4>John Doe</h4>
<p>[email protected]</p>
</div>
<div class="clear"></div>
</div>
</ion-menu-toggle>
<div class="sidemenu_list">
<ul>
<ion-menu-toggle>
<li (click)="vieworder('home')">Shop</li>
</ion-menu-toggle>
<li>About us</li>
<ion-menu-toggle>
<li (click)="vieworder('myorder')">View Order</li>
</ion-menu-toggle>
<div class="sub_menu">
<ul *ngIf="categoryService.activecategories">
<ion-menu-toggle>
<li *ngFor="let category of categoryService.activecategories" (click)="goToPage('catstorelist', category)">{{category.catName}}</li>
</ion-menu-toggle>
<!-- <li>Women's Fashion</li>
<div class="sub_menu">
<ul *ngIf="categoryService.activecategories">
<ion-menu-toggle>
<li
*ngFor="let category of categoryService.activecategories"
(click)="goToPage('catstorelist', category)"
>
{{ category.catName }}
</li>
</ion-menu-toggle>
<!-- <li>Women's Fashion</li>
<li>Features</li>
<li>Bags</li>
<li>Shoes</li>
<li>Electronics</li> -->
</ul>
</div>
<li>Complaints & Feedback</li>
<li>
<span class="floatLeft" (click)="authService.SignOut()">Logout</span>
<span class="floatRight version">Version 0.1.0.2</span>
<div class="clear"></div>
</li>
</ul>
</div>
</div>
</ion-content>
</ion-menu>
<ion-router-outlet main></ion-router-outlet>
</ion-split-pane>
</ul>
</div>
<li>Complaints & Feedback</li>
<li>
<span class="floatLeft" (click)="authService.SignOut()"
>Logout</span
>
<span class="floatRight version">Version 0.1.0.2</span>
<div class="clear"></div>
</li>
</ul>
</div>
</div>
</ion-content>
</ion-menu>
<ion-router-outlet main></ion-router-outlet>
</ion-split-pane>
</ion-app>
<div class="common_tab" [hidden]="getState()">
<ul>
<li (click)="goToPage('home')">
<div class="icon_sec m1_icon" [class.m1_icon_act]="sec_active1" (click)="setActive1()"></div>
</li>
<li (click)="goToPage('catagory')">
<div class="icon_sec m2_icon" [class.m2_icon_act]="sec_active2" (click)="setActive2()"></div>
</li>
<li (click)="goToPage('catagory')">
<div class="icon_sec m3_icon" [class.m3_icon_act]="sec_active3" (click)="setActive3()"></div>
</li>
<!-- <li (click)="goToPage('cart')">
<ul>
<li (click)="goToPage('home')">
<div
class="icon_sec m1_icon"
[class.m1_icon_act]="sec_active1"
(click)="setActive1()"
></div>
</li>
<li (click)="goToPage('catagory')">
<div
class="icon_sec m2_icon"
[class.m2_icon_act]="sec_active2"
(click)="setActive2()"
></div>
</li>
<li (click)="goToPage('catagory')">
<div
class="icon_sec m3_icon"
[class.m3_icon_act]="sec_active3"
(click)="setActive3()"
></div>
</li>
<!-- <li (click)="goToPage('cart')">
<div class="icon_sec m4_icon" [class.m4_icon_act]="sec_active4" (click)="setActive4()"></div>
</li> -->
<li (click)="goToPage('myorder')">
<div class="icon_sec m5_icon" [class.m5_icon_act]="sec_active5" (click)="setActive5()"></div>
</li>
<li (click)="goToPage('profile')">
<div class="icon_sec m6_icon" [class.m6_icon_act]="sec_active6" (click)="setActive6()"></div>
</li>
</ul>
</div>
\ No newline at end of file
<li (click)="goToPage('myorder')">
<div
class="icon_sec m5_icon"
[class.m5_icon_act]="sec_active5"
(click)="setActive5()"
></div>
</li>
<li (click)="goToPage('profile')">
<div
class="icon_sec m6_icon"
[class.m6_icon_act]="sec_active6"
(click)="setActive6()"
></div>
</li>
</ul>
</div>
<div class="nav_header">
<button class="nav_btn nav_back floatLeft" (click)="goBack()">
<img src="../assets/Group17_2.png">
<button class="nav_btn nav_back floatLeft" (click)="goBack()">
<img src="../assets/Group17_2.png" />
</button>
<div class="nav_title floatLeft">
<h4>CHANGE DETAILS</h4>
</div>
<div class="clear"></div>
<div class="nav_title floatLeft">
<h4>CHANGE DETAILS</h4>
</div>
<div class="clear"></div>
</div>
<ion-content>
<div class="login_wrapper">
<div class="form_div">
<div class="row">
<h6>Personal Details</h6>
</div>
<div class="row">
<input class="" type="text" placeholder="John Doe">
</div>
<div class="row">
<input class="" type="mail" placeholder="[email protected]">
</div>
<div class="row">
<input class="" type="number" placeholder="+00 9851 5871 6985">
</div>
<div class="row">
<h6>Change Password</h6>
</div>
<div class="row">
<input class="" type="password" placeholder="Current Password">
</div>
<div class="row">
<input class="" type="password" placeholder="New Password">
</div>
<div class="row">
<input class="" type="password" placeholder="Confirm Password">
</div>
<div class="row">
<button class="login_btn">UPDATE</button>
</div>
<div class="login_wrapper">
<form class="form_div" #updateForm="ngForm" novalidate>
<div class="row">
<h6>Personal Details</h6>
</div>
<div class="row">
<input
name="name"
required
class=""
type="text"
[(ngModel)]="updateData.name"
placeholder="John Doe"
#name="ngModel"
/>
<div
class="md-errors-spacer"
[hidden]="name.valid || submitted == false"
class="ion-padding-start"
>
Name is required
</div>
</div>
</ion-content>
\ No newline at end of file
</div>
<div class="row">
<input
required
class=""
name="emailId"
type="mail"
[(ngModel)]="updateData.emailId"
placeholder="[email protected]"
pattern="[a-zA-Z0-9.-_]{1,}@[a-zA-Z.-]{2,}[.]{1}[a-zA-Z]{2,}"
#emailId="ngModel"
/>
<div
class="md-errors-spacer"
[hidden]="emailId.valid || submitted == false"
>
<div *ngIf="emailId.errors && emailId.errors.required">
Email is required
</div>
<div *ngIf="emailId.errors && emailId.errors.pattern">
Email is invalid
</div>
</div>
</div>
<div class="row">
<input
required
class=""
name="phone"
type="number"
pattern="(\(+61\)|\+61|\(0[1-9]\)|0[1-9])?( ?-?[0-9]){6,9}"
maxlength="10"
[(ngModel)]="updateData.phone"
placeholder="+00 9851 5871 6985"
#phone="ngModel"
/>
<div
class="md-errors-spacer"
[hidden]="phone.valid || submitted == false"
>
<div *ngIf="phone.errors && phone.errors.required">
Phone number is required
</div>
<div *ngIf="phone.errors && phone.errors.pattern">
Phone is invalid
</div>
</div>
</div>
<div class="row">
<h6>Change Password</h6>
</div>
<div class="row">
<input class="" type="password" placeholder="Current Password" />
</div>
<div class="row">
<input class="" type="password" placeholder="New Password" />
</div>
<div class="row">
<input class="" type="password" placeholder="Confirm Password" />
</div>
<div class="row">
<button class="login_btn" (click)="onFormSubmit(updateForm)">
UPDATE
</button>
</div>
</form>
</div>
</ion-content>
import { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common';
import { Router, ActivatedRoute } from '@angular/router';
import { Component, OnInit } from "@angular/core";
import { Location } from "@angular/common";
import { Router, ActivatedRoute } from "@angular/router";
import { UpdateUserDetails } from "../../config/services/user";
import { UpdateService } from "../../config/update.service";
import { ServiceService } from "../../config/service.service";
import { NgForm } from "@angular/forms";
@Component({
selector: 'app-changedetails',
templateUrl: './changedetails.page.html',
styleUrls: ['./changedetails.page.scss'],
selector: "app-changedetails",
templateUrl: "./changedetails.page.html",
styleUrls: ["./changedetails.page.scss"]
})
export class ChangedetailsPage implements OnInit {
userData: any;
updateData: UpdateUserDetails = {
emailId: "",
name: "",
phone: ""
};
submitted = false;
constructor(
private router: Router,
private route: ActivatedRoute,
private location: Location
) { }
ngOnInit() {
private location: Location,
public register: UpdateService,
private service: ServiceService
) {
this.service.get("params").then(val => {
this.userData = val;
});
}
ngOnInit() {}
goToPage(path, data = null) {
this.router.navigateByUrl(path, { queryParams: data });
......@@ -29,4 +43,11 @@ export class ChangedetailsPage implements OnInit {
this.location.back();
}
onFormSubmit(form: NgForm) {
this.submitted = true;
if (form.valid) {
console.log("valid form values", form.value);
this.register.updateData(form.value, this.userData.uid);
}
}
}
import { Component, OnInit } from "@angular/core";
import { Location } from "@angular/common";
import { trigger, transition, animate, style } from "@angular/animations";
import { MapsAPILoader, MouseEvent } from "@agm/core";
import { Router, ActivatedRoute } from "@angular/router";
import { MenuController } from "@ionic/angular";
import { CenterService } from "./../../config/center.service";
import { ShoppersService } from "./../../config/shopper.service";
import { CategoriesService } from "./../../config/category.service";
import { ServiceService } from "./../../config/service.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 { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common';
import { trigger, transition, animate, style } from '@angular/animations';
import { MapsAPILoader, MouseEvent } from '@agm/core';
import { Router, ActivatedRoute } from '@angular/router';
import { MenuController } from '@ionic/angular';
import { CenterService } from './../../config/center.service';
import { ShoppersService } from './../../config/shopper.service';
import { CategoriesService } from './../../config/category.service';
import { ServiceService } from './../../config/service.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';
@Component({
selector: "app-home",
templateUrl: "./home.page.html",
styleUrls: ["./home.page.scss"],
selector: 'app-home',
templateUrl: './home.page.html',
styleUrls: ['./home.page.scss'],
animations: [
trigger("slideInOut", [
transition(":enter", [
style({ transform: "translateY(100%)" }),
animate("200ms ease-in", style({ transform: "translateY(0%)" }))
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%)" }))
transition(':leave', [
animate('200ms ease-out', style({ transform: 'translateY(100%)' }))
])
])
]
......@@ -65,7 +65,7 @@ export class HomePage implements OnInit {
this.geoCoder = new google.maps.Geocoder();
});
this.menuCtrl.enable(true);
const users = this.service.get("user").then(data => {
const users = this.service.get('user').then(data => {
if (data) {
data = JSON.parse(data);
this.custId = data.uid;
......@@ -75,7 +75,7 @@ export class HomePage implements OnInit {
}
private setCurrentLocation() {
if ("geolocation" in navigator) {
if ('geolocation' in navigator) {
navigator.geolocation.getCurrentPosition(position => {
this.lat = position.coords.latitude;
this.lng = position.coords.longitude;
......@@ -90,16 +90,16 @@ export class HomePage implements OnInit {
(results, status) => {
console.log(results);
console.log(status);
if (status === "OK") {
if (status === 'OK') {
if (results[0]) {
const addressData = results[0].formatted_address.split(", ");
this.address = addressData[0] + ", " + addressData[1];
const addressData = results[0].formatted_address.split(', ');
this.address = addressData[0] + ', ' + addressData[1];
console.log(this.address);
} else {
window.alert("No results found");
window.alert('No results found');
}
} else {
window.alert("Geocoder failed due to: " + status);
window.alert('Geocoder failed due to: ' + status);
}
}
);
......@@ -124,7 +124,7 @@ export class HomePage implements OnInit {
goToPage(path, data = null) {
console.log(data);
this.service.set("params", data);
this.service.set('params', data);
this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
......@@ -141,19 +141,19 @@ export class HomePage implements OnInit {
console.log(datas);
let data;
let url;
if (datas.type === "shopper") {
if (datas.type === 'shopper') {
data = datas.data;
this.service.set("params", data);
url = "productlist";
} else if (datas.type === "category") {
this.service.set('params', data);
url = 'productlist';
} else if (datas.type === 'category') {
data = datas.data;
this.service.set("params", data);
url = "catstorelist";
this.service.set('params', data);
url = 'catstorelist';
} else {
data = datas.data;
data.size = this.service.splitSep(data.size);
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.productsService.setProd(data);
}
this.searchClose();
......@@ -162,6 +162,7 @@ export class HomePage implements OnInit {
}
searchFun(data: string) {
this.searchShow = true;
this.searchService.search(data);
}
......
import { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common';
import { Router, ActivatedRoute } from '@angular/router';
import { Products } from './../../config/services/product';
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;
bannerOptions = {
slidesPerView: 1,
......@@ -47,15 +51,25 @@ 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);
// console.log(this.prodService.fav);
}
ngOnInit() {
console.log(this.prodService.selItem);
// console.log("[qwe]", this.prodService.selItem);
const params = this.prodService.selItem;
this.getProd(params);
}
......@@ -88,14 +102,14 @@ export class ProductdetailPage implements OnInit {
} else {
this.product = undefined;
}
console.log(this.product);
// console.log(this.product.image);
}
stringObject(items: any) {
items.forEach(element => {
console.log(element.sizeId);
// console.log(element.sizeId);
element = JSON.parse(element);
console.log(element);
// console.log(element);
});
}
......@@ -112,7 +126,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');
}
......@@ -126,21 +140,21 @@ 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) {
const state = this.prodService.fav.findIndex(x => x === index);
console.log(state);
console.log(this.prodService.fav);
// console.log(state);
// 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);
// console.log(this.prodService.fav);
}
}
<div class="nav_header">
<ion-menu-toggle>
<button class="nav_btn nav_menu floatLeft">
</button>
</ion-menu-toggle>
<div class="nav_title floatLeft">
<img src="../../assets/Group [email protected]">
</div>
<div class="clear"></div>
<ion-menu-toggle>
<button class="nav_btn nav_menu floatLeft"></button>
</ion-menu-toggle>
<div class="nav_title floatLeft">
<img src="../../assets/Group [email protected]" />
</div>
<div class="clear"></div>
</div>
<ion-content>
<div class="profile_wrapper">
<div class="profile_banner">
<div class="profile_circle">
<div class="edit"></div>
</div>
<h5>JOHN DOE</h5>
<p>LOGOUT</p>
</div>
<div class="account_wrapper">
<div class="account_header">
<h5 class="floatLeft">ACCOUNT INFORMATION</h5>
<span class="floatRight"><img src="../../assets/edit.png"></span>
<div class="clear"></div>
</div>
<div class="row">
<ion-row>
<ion-col class="textLeft p0">
<p>Name<span>Verfied</span></p>
</ion-col>
<ion-col class="textRight p0">
<h6>John Doe</h6>
</ion-col>
</ion-row>
</div>
<div class="row">
<ion-row>
<ion-col class="textLeft p0">
<p>Email<span>Not Verfied yet</span></p>
</ion-col>
<ion-col class="textRight p0">
<h6>[email protected]</h6>
</ion-col>
</ion-row>
</div>
<hr>
<ion-row>
<ion-col class="textLeft p0">
<p>Wishlist</p>
</ion-col>
<ion-col class="textRight p0">
<h6>(3)</h6>
</ion-col>
</ion-row>
<hr>
<ion-row>
<ion-col class="textLeft p0">
<p>Address</p>
</ion-col>
<ion-col class="textRight p0">
<h6>(1)</h6>
</ion-col>
</ion-row>
<hr>
<ion-row>
<ion-col class="textLeft p0">
<p>My Cards</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>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>
<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="profile_wrapper">
<div class="profile_banner">
<div class="profile_circle">
<div class="edit"></div>
</div>
<h5>{{user && user.name}}</h5>
<p>LOGOUT</p>
</div>
<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>
<div class="clear"></div>
</div>
<div class="row">
<ion-row>
<ion-col class="textLeft p0">
<p>
Name<span
>{{user && phoneVerified? "Verified": "Not Verified yet"}}</span
>
</p>
</ion-col>
<ion-col class="textRight p0">
<h6>{{user && user.name}}</h6>
</ion-col>
</ion-row>
</div>
<div class="row">
<ion-row>
<ion-col class="textLeft p0">
<p>
Email<span
>{{user && emailVerified? "Verified": "Not Verified yet"}}</span
>
</p>
</ion-col>
<ion-col class="textRight p0">
<h6>{{user && user.emailId}}</h6>
</ion-col>
</ion-row>
</div>
<hr />
<ion-row>
<ion-col class="textLeft p0">
<p>Wishlist</p>
</ion-col>
<ion-col class="textRight p0">
<h6>(3)</h6>
</ion-col>
</ion-row>
<hr />
<ion-row>
<ion-col class="textLeft p0">
<p>Address</p>
</ion-col>
<ion-col class="textRight p0">
<h6>(1)</h6>
</ion-col>
</ion-row>
<hr />
<ion-row>
<ion-col class="textLeft p0">
<p>My Cards</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>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>
<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>
</ion-content>
\ No newline at end of file
</div>
</ion-content>
import { Component, OnInit } from '@angular/core';
import { Component, OnInit } from "@angular/core";
import { User } from "../../config/services/user";
import { UserService } from "../../config/user.service";
import { ServiceService } from "../../config/service.service";
import { Router, ActivatedRoute } from "@angular/router";
@Component({
selector: 'app-profile',
templateUrl: './profile.page.html',
styleUrls: ['./profile.page.scss'],
selector: "app-profile",
templateUrl: "./profile.page.html",
styleUrls: ["./profile.page.scss"]
})
export class ProfilePage implements OnInit {
user: User;
userdata: any;
custId: String;
constructor() { }
constructor(
private router: Router,
private useService: UserService,
private service: ServiceService
) {
const params = this.useService.users;
const userdata = this.service.get("user").then(data => {
if (data) {
data = JSON.parse(data);
this.service.set("params", data);
ngOnInit() {
this.custId = data.uid;
}
});
this.useService.getUserData("9cYSZwGvVpgkUHVcz8Dm6oqGX152");
// .then(res => {
// console.log("asdasda", res);
// this.userdata = res;
// });
}
goToPage(path, data = null) {
this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
ngOnInit() {
let This = this;
setTimeout(() => {
this.user = this.useService.users;
console.log("[users]", this.user);
this.service.set("params", this.user);
}, 500);
}
}
......@@ -2,27 +2,14 @@
<button class="nav_btn nav_back floatLeft" (click)="closeModal()">
</button>
<div class="nav_title floatLeft relative">
<input class="search_bar" placeholder="Search here.. eg:shirts, retailers etc...">
<input class="search_bar" placeholder="Search here.. eg:shirts, retailers etc..." (click)="clickSearch()" (input)="searchFun($event.target.value)" #searchText>
</div>
<button class="nav_btn nav_close floatRight" (click)="closeModal()">
</button>
<div class="clear"></div>
</div>
<div class="search_item_list">
<ul>
<li>Item </li>
<li>Item </li>
<li>Item </li>
<li>Item </li>
<li>Item </li>
<li>Item </li>
<li>Item </li>
<li>Item </li>
<li>Item </li>
<li>Item </li>
<li>Item </li>
<li>Item </li>
<li>Item </li>
<li>Item </li>
<ul *ngIf="searchService.searchList">
<li *ngFor="let search of searchService.searchList" (click)="viewPage(search)">{{search.text}} </li>
</ul>
</div>
\ No newline at end of file
import { Component, OnInit } from "@angular/core";
import { ModalController, NavParams } from "@ionic/angular";
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { ModalController, NavParams } from '@ionic/angular';
import { SearchService } from './../../config/search.service';
import { ServiceService } from './../../config/service.service';
import { ProductsService } from './../../config/products.service';
@Component({
selector: "app-searchmodal",
templateUrl: "./searchmodal.page.html",
styleUrls: ["./searchmodal.page.scss"]
selector: 'app-searchmodal',
templateUrl: './searchmodal.page.html',
styleUrls: ['./searchmodal.page.scss']
})
export class SearchmodalPage implements OnInit {
searchShow = false;
constructor(
private modalController: ModalController,
private navParams: NavParams
private navParams: NavParams,
private searchService: SearchService,
public service: ServiceService,
private productsService: ProductsService,
private router: Router
) {}
ngOnInit() {}
ngOnInit() {
this.searchService.searchList = [];
}
async closeModal() {
await this.modalController.dismiss();
}
searchFun(data: string) {
this.searchShow = true;
this.searchService.search(data);
}
clickSearch() {
this.searchShow = true;
this.searchService.searchList = [];
}
viewPage(datas: any) {
this.closeModal();
console.log(datas);
let data;
let url;
if (datas.type === 'shopper') {
data = datas.data;
this.service.set('params', data);
url = 'productlist';
} else if (datas.type === 'category') {
data = datas.data;
this.service.set('params', data);
url = 'catstorelist';
} else {
data = datas.data;
data.size = this.service.splitSep(data.size);
data.tag = this.service.splitSep(data.tag);
(data.color = this.service.splitSep(data.color)), (url = 'productdetail');
this.productsService.setProd(data);
}
this.searchClose();
this.router.navigateByUrl(url, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
searchClose() {
this.closeModal();
this.searchShow = false;
}
}
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 { AddressList, Address } from "./services/address";
import { database } from "firebase";
import { take } from "rxjs/operators";
@Injectable({
providedIn: 'root'
providedIn: "root"
})
export class AddressService {
addressList: AddressList[] = [];
constructor(
public afs: AngularFirestore
) {
}
constructor(public afs: AngularFirestore) {}
public async addList(userId: string) {
const This = this;
const state = true;
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('address', ref => ref.where('status', '==', state)
.where('uid', '==', userId));
orderRef.valueChanges().pipe(
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"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) => {
this.addressList = [];
const res = value;
if (res.length > 0) {
res.forEach((item) => {
console.log(item);
const address: AddressList = {
address: item.address,
addressType: item.addressType,
latLng: item.latLng,
defaultVal: item.defaultVal,
building: item. building,
landmark: item.landmark,
addressId: item.addressId
};
this.addressList.push(address);
});
console.log(this.addressList);
} else {
// alert('No Orders Found');
}
});
)
.subscribe(value => {
this.addressList = [];
const res = value;
if (res.length > 0) {
res.forEach(item => {
// console.log(item);
const address: AddressList = {
address: item.address,
addressType: item.addressType,
latLng: item.latLng,
defaultVal: item.defaultVal,
building: item.building,
landmark: item.landmark,
addressId: item.addressId
};
this.addressList.push(address);
});
// console.log(this.addressList);
} else {
// alert('No Orders Found');
}
});
}
addressCreate(data: Address) {
this.afs.collection('address').add({}).then((docRef) => {
data.addressId = docRef.id;
this.afs.collection('address').doc(data.addressId).set(data).then(() => {
console.log('Address created Successfully');
this.afs
.collection("address")
.add({})
.then(docRef => {
data.addressId = docRef.id;
this.afs
.collection("address")
.doc(data.addressId)
.set(data)
.then(() => {
// console.log('Address created Successfully');
});
});
});
}
setDefaultAddress(addId: string, userId: string) {
this.afs.collection('address', ref => ref.where('uid', '==', userId)).get().forEach((item) => {
this.afs
.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});
return this.afs.doc(`address/${m.id}`).update({ defaultVal: 0 });
});
});
this.afs.collection('address').doc(addId).update({defaultVal: 1}).then(() => {
console.log('Address updated Successfully');
});
});
this.afs
.collection("address")
.doc(addId)
.update({ defaultVal: 1 })
.then(() => {
// console.log('Address updated Successfully');
});
}
}
import { Injectable } from '@angular/core';
import { AngularFirestore, AngularFirestoreDocument, AngularFirestoreCollection } from '@angular/fire/firestore';
import { Router, ActivatedRoute } from '@angular/router';
import { Products } from './services/product';
import { Cart, CartItem } from './services/cart';
import { ServiceService } from './service.service';
import * as firebase from 'firebase';
import { take } from 'rxjs/operators';
import { User } from './services/user';
import { from } from 'rxjs';
import { Injectable } from "@angular/core";
import {
AngularFirestore,
AngularFirestoreDocument,
AngularFirestoreCollection
} from "@angular/fire/firestore";
import { Router, ActivatedRoute } from "@angular/router";
import { Products } from "./services/product";
import { Cart, CartItem } from "./services/cart";
import { ServiceService } from "./service.service";
import * as firebase from "firebase";
import { take } from "rxjs/operators";
import { User } from "./services/user";
import { from } from "rxjs";
@Injectable({
providedIn: 'root'
providedIn: "root"
})
export class CartsService {
size: string;
......@@ -27,13 +31,13 @@ export class CartsService {
public router: Router,
public service: ServiceService
) {
this.custId = '';
this.custId = "";
this.carts = [];
const users = this.service.get('user').then(data => {
const users = this.service.get("user").then(data => {
if (data) {
data = JSON.parse(data);
this.custId = data.uid;
console.log(this.custId);
// console.log(this.custId);
}
});
}
......@@ -42,30 +46,30 @@ export class CartsService {
this.prodId = product.prodId;
const prodRef = firebase
.firestore()
.collection('products')
.collection("products")
.doc(this.prodId);
this.size = this.size === undefined ? product.size[0] : this.size;
this.color = this.color === undefined ? product.color[0] : this.color;
const cartRef: AngularFirestoreCollection<any> = this.afs.collection(
'carts',
"carts",
ref =>
ref
.where('size', '==', this.size)
.where('color', '==', this.color)
.where('custId', '==', this.custId)
.where('product', '==', prodRef)
.where("size", "==", this.size)
.where("color", "==", this.color)
.where("custId", "==", this.custId)
.where("product", "==", prodRef)
);
cartRef
.valueChanges()
.pipe(take(1))
.subscribe(value => {
console.log(value);
// console.log(value);
if (value.length === 0) {
product.image =
product.image === undefined
? '../assets/[email protected]'
? "../assets/[email protected]"
: product.image;
const cart: Cart = {
color: this.color,
......@@ -80,36 +84,36 @@ export class CartsService {
qty: 1,
size: this.size
};
console.log(cart);
// console.log(cart);
this.afs
.collection('carts')
.collection("carts")
.add(cart)
.then(docRef => {
const neworderId = docRef.id;
this.afs
.collection('carts')
.collection("carts")
.doc(neworderId)
.update({ cartId: docRef.id })
.then(() => {
console.log('Booking Successfully');
// console.log('Booking Successfully');
document.body.scrollTop = document.documentElement.scrollTop = 0;
});
})
.catch(error => {
console.error('Error adding document: ', error);
console.error("Error adding document: ", error);
});
} else {
console.log(value);
// console.log(value);
// alert('Item already added in the cart');
const cartId = value[0].cartId;
// tslint:disable-next-line:radix
const qty = parseInt(value[0].qty) + 1;
this.afs
.collection('carts')
.collection("carts")
.doc(cartId)
.update({ qty: `${qty}` })
.then(() => {
console.log('Booking Successfully');
// console.log('Booking Successfully');
document.body.scrollTop = document.documentElement.scrollTop = 0;
});
}
......@@ -118,8 +122,8 @@ export class CartsService {
public async cartList() {
const cartRef: AngularFirestoreCollection<any> = this.afs.collection(
'carts',
ref => ref.where('custId', '==', this.custId)
"carts",
ref => ref.where("custId", "==", this.custId)
);
cartRef.valueChanges().subscribe(value => {
this.carts = [];
......@@ -139,7 +143,7 @@ export class CartsService {
qty: item.qty,
size: item.size
};
console.log(item.price, item.qty);
// console.log(item.price, item.qty);
if (item.price) {
this.cartTotal += item.price * item.qty;
}
......@@ -175,9 +179,9 @@ export class CartsService {
? this.carts[index].qty - 1
: this.carts[index].qty;
this.carts[index].qty = qty;
console.log(this.carts[index].qty);
// console.log(this.carts[index].qty);
this.afs
.collection('carts')
.collection("carts")
.doc(this.carts[index].cartId)
.update({
qty: this.carts[index].qty
......@@ -189,7 +193,7 @@ export class CartsService {
this.cartTotal = 0;
this.carts[index].qty = qty;
this.afs
.collection('carts')
.collection("carts")
.doc(this.carts[index].cartId)
.update({
qty: this.carts[index].qty
......@@ -198,21 +202,19 @@ export class CartsService {
removeItem(index) {
this.afs
.collection('carts')
.collection("carts")
.doc(this.carts[index].cartId)
.delete();
}
checkPromo(promoCode: string) {
console.log(promoCode);
// console.log(promoCode);
const state = true;
const promoRef: AngularFirestoreCollection<any> = this.afs.collection('promocode', ref => ref.where('promoCode', '==', promoCode)
.where('status', '==', state));
const promoRef: AngularFirestoreCollection<any> = this.afs.collection(
"promocode",
ref =>
ref.where("promoCode", "==", promoCode).where("status", "==", state)
);
return promoRef.valueChanges();
}
}
import { Injectable } from '@angular/core';
import { AngularFirestore, AngularFirestoreDocument, AngularFirestoreCollection } from '@angular/fire/firestore';
import { Category } from './services/category';
import * as firebase from 'firebase';
import { ServiceService } from './service.service';
import { Injectable } from "@angular/core";
import {
AngularFirestore,
AngularFirestoreDocument,
AngularFirestoreCollection
} from "@angular/fire/firestore";
import { Category } from "./services/category";
import * as firebase from "firebase";
import { ServiceService } from "./service.service";
@Injectable({
providedIn: 'root'
providedIn: "root"
})
export class CategoriesService {
categories: Category[] = [];
activecategories: Category[] = [];
constructor(
public afs: AngularFirestore,
public service: ServiceService
) {
constructor(public afs: AngularFirestore, public service: ServiceService) {
this.categoryList();
this.activeCategory();
}
public async categoryList() {
const This = this;
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('shopcategory');
orderRef.valueChanges().subscribe((value) => {
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"shopcategory"
);
orderRef.valueChanges().subscribe(value => {
this.categories = [];
const res = value;
if (res.length > 0) {
res.forEach((item) => {
console.log(item);
res.forEach(item => {
// console.log(item);
const category: Category = {
catId: item.catId,
catName: item.catName,
......@@ -36,7 +39,7 @@ export class CategoriesService {
};
this.categories.push(category);
});
console.log(this.categories);
// console.log(this.categories);
} else {
// alert('No Orders Found');
}
......@@ -46,13 +49,16 @@ export class CategoriesService {
public async activeCategory() {
const This = this;
const state = true;
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('shopcategory', ref => ref.where('status', '==', state));
orderRef.valueChanges().subscribe((value) => {
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"shopcategory",
ref => ref.where("status", "==", state)
);
orderRef.valueChanges().subscribe(value => {
this.activecategories = [];
const res = value;
if (res.length > 0) {
res.forEach((item) => {
console.log(item);
res.forEach(item => {
// console.log(item);
const category: Category = {
catId: item.catId,
catName: item.catName,
......@@ -62,7 +68,7 @@ export class CategoriesService {
};
this.activecategories.push(category);
});
console.log(this.activecategories);
// console.log(this.activecategories);
} else {
// alert('No Orders Found');
}
......
import { Injectable } from '@angular/core';
import { AngularFirestore, AngularFirestoreDocument, AngularFirestoreCollection } from '@angular/fire/firestore';
import { Centers, CenterData } from './services/center';
import * as firebase from 'firebase';
import { Injectable } from "@angular/core";
import {
AngularFirestore,
AngularFirestoreDocument,
AngularFirestoreCollection
} from "@angular/fire/firestore";
import { Centers, CenterData } from "./services/center";
import * as firebase from "firebase";
@Injectable({
providedIn: 'root'
providedIn: "root"
})
export class CenterService {
centers: Centers[] = [];
nearcenters: Centers[] = [];
constructor(
public afs: AngularFirestore
) {
constructor(public afs: AngularFirestore) {
this.centerList();
this.getNearBy(10.0159, 76.3419, 10);
}
......@@ -19,14 +21,16 @@ export class CenterService {
public async centerList() {
const This = this;
const state = true;
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('centers', ref => ref.where('featured', '==', state)
.where('status', '==', state));
orderRef.valueChanges().subscribe((value) => {
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"centers",
ref => ref.where("featured", "==", state).where("status", "==", state)
);
orderRef.valueChanges().subscribe(value => {
this.centers = [];
const res = value;
if (res.length > 0) {
res.forEach((item) => {
console.log(item);
res.forEach(item => {
// console.log(item);
if (item.centerName === undefined) {
return;
}
......@@ -42,7 +46,7 @@ export class CenterService {
};
this.centers.push(center);
});
console.log(this.centers);
// console.log(this.centers);
} else {
// alert('No Orders Found');
}
......@@ -56,22 +60,31 @@ export class CenterService {
const lat = 0.0144927536231884;
const lon = 0.0181818181818182;
const lowerLat = latitude - (lat * distance);
const lowerLon = longitude - (lon * distance);
const lowerLat = latitude - lat * distance;
const lowerLon = longitude - lon * distance;
const greaterLat = latitude + (lat * distance);
const greaterLon = longitude + (lon * distance);
const greaterLat = latitude + lat * distance;
const greaterLon = longitude + lon * distance;
const lesserGeopoint = new firebase.firestore.GeoPoint(lowerLat, lowerLon);
const greaterGeopoint = new firebase.firestore.GeoPoint(greaterLat, greaterLon);
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('centers', ref => ref.where('latLng', '>', lesserGeopoint)
.where('latLng', '<', greaterGeopoint).where('status', '==', state));
orderRef.valueChanges().subscribe((value) => {
const greaterGeopoint = new firebase.firestore.GeoPoint(
greaterLat,
greaterLon
);
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"centers",
ref =>
ref
.where("latLng", ">", lesserGeopoint)
.where("latLng", "<", greaterGeopoint)
.where("status", "==", state)
);
orderRef.valueChanges().subscribe(value => {
this.nearcenters = [];
const res = value;
if (res.length > 0) {
res.forEach((item) => {
console.log(item);
res.forEach(item => {
// console.log(item);
if (item.centerName === undefined) {
return;
}
......@@ -87,11 +100,10 @@ export class CenterService {
};
this.nearcenters.push(center);
});
console.log(this.nearcenters);
// console.log(this.nearcenters);
} else {
// alert('No Orders Found');
}
});
}
}
import { Injectable } from '@angular/core';
import { AngularFirestore, AngularFirestoreDocument, AngularFirestoreCollection } from '@angular/fire/firestore';
import { Myorder } from './services/myorder';
import { ServiceService } from './../config/service.service';
import * as firebase from 'firebase';
import { take } from 'rxjs/operators';
import { Observable, of } from 'rxjs';
import { Injectable } from "@angular/core";
import {
AngularFirestore,
AngularFirestoreDocument,
AngularFirestoreCollection
} from "@angular/fire/firestore";
import { Myorder } from "./services/myorder";
import { ServiceService } from "./../config/service.service";
import * as firebase from "firebase";
import { take } from "rxjs/operators";
import { Observable, of } from "rxjs";
@Injectable({
providedIn: 'root'
providedIn: "root"
})
export class MyordersService {
product: Myorder[] = [];
......@@ -15,11 +19,8 @@ export class MyordersService {
orders: Myorder[];
selItem: Myorder;
constructor(
public afs: AngularFirestore,
public service: ServiceService
) {
const users = this.service.get('user').then((data) => {
constructor(public afs: AngularFirestore, public service: ServiceService) {
const users = this.service.get("user").then(data => {
if (data) {
data = JSON.parse(data);
this.custId = data.uid;
......@@ -28,28 +29,28 @@ export class MyordersService {
// this.orderState();
}
} else {
this.custId = 'WwHnLICVY2dvZGUHuKqasiTB91a2';
this.custId = "WwHnLICVY2dvZGUHuKqasiTB91a2";
}
});
}
/*public async orgorderList(custId) {
console.log('called');
console.log(custId);
// console.log('called');
// console.log(custId);
const This = this;
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('orders', ref => ref.where('custId', '==', custId)
.orderBy('bookDate', 'desc'));
orderRef.stateChanges().subscribe((value) => {
console.log(value[0].payload.doc.data());
// console.log(value[0].payload.doc.data());
});
orderRef.valueChanges().pipe(take(1)).subscribe((value) => {
console.log(value);
// console.log(value);
this.orders = [];
const res = value;
if (res.length > 0) {
res.forEach((item) => {
console.log(item);
// console.log(item);
const order: Myorder = {
prodName: item.prodName,
color: item.color,
......@@ -70,7 +71,7 @@ export class MyordersService {
};
this.orders.push(order);
});
console.log(this.orders);
// console.log(this.orders);
} else {
alert('No Orders Found');
}
......@@ -78,22 +79,23 @@ export class MyordersService {
});
}*/
public async orderList(custId) {
console.log('called');
console.log(custId);
// console.log('called');
// console.log(custId);
const This = this;
this.orders = [];
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('orders', ref => ref.where('custId', '==', custId)
.orderBy('bookDate', 'desc'));
orderRef.stateChanges().subscribe((value) => {
console.log(value);
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"orders",
ref => ref.where("custId", "==", custId).orderBy("bookDate", "desc")
);
orderRef.stateChanges().subscribe(value => {
// console.log(value);
const res = value;
console.log(res);
// console.log(res);
if (res.length > 0) {
res.forEach((items) => {
res.forEach(items => {
const item = items.payload.doc.data();
console.log(item);
// console.log(item);
const orderId = item.orderId;
const order: Myorder = {
amount: item.amount,
......@@ -103,40 +105,39 @@ export class MyordersService {
deliveryLocation: item.deliveryLocation,
pickupLocation: item.pickupLocation,
deliveryAddress: item.deliveryAddress,
riderName: 'John',
riderName: "John",
orderId: item.orderId,
orderCode: item.orderCode,
product: this.service.key2Array(item.product),
time: '60'
time: "60"
};
console.log(order);
if (items.type === 'added') {
// console.log(order);
if (items.type === "added") {
this.orders.push(order);
} else {
console.log(orderId);
// console.log(orderId);
const index = this.orders.findIndex(obj => obj.orderId === orderId);
if (index >= 0) {
this.orders[index] = order;
}
}
});
console.log(this.orders);
}
// console.log(this.orders);
}
});
}
/* public orderState(): Observable<Myorder[]> {
console.log('called');
/* public orderState(): Observable<Myorder[]> {
// console.log('called');
const custId = 'WwHnLICVY2dvZGUHuKqasiTB91a2';
this.orders = [];
firebase.firestore().collection('orders').where('custId', '==', custId)
.onSnapshot((snapData) => {
snapData.docChanges().forEach((change) => {
console.log(change.type);
// console.log(change.type);
if (change.type === 'modified') {
const item = change.doc.data();
console.log(item);
// console.log(item);
const orderId = item.orderId;
const order: Myorder = {
prodName: item.prodName,
......@@ -157,9 +158,9 @@ export class MyordersService {
const count = this.orders.length;
for (let index = 0; index < count; index++) {
if (this.orders[index].orderId === orderId) {
console.log(index);
// console.log(index);
this.orders[index] = order;
console.log(this.orders);
// console.log(this.orders);
break;
}
}
......@@ -195,13 +196,13 @@ export class MyordersService {
.onSnapshot(function(snapshot) {
snapshot.docChanges().forEach(function(change) {
if (change.type === "added") {
console.log("New city: ", change.doc.data());
// console.log("New city: ", change.doc.data());
}
if (change.type === "modified") {
console.log("Modified city: ", change.doc.data());
// console.log("Modified city: ", change.doc.data());
}
if (change.type === "removed") {
console.log("Removed city: ", change.doc.data());
// console.log("Removed city: ", change.doc.data());
}
});
});
......@@ -209,7 +210,6 @@ export class MyordersService {
}
*/
public async trackOrder(order) {
this.selItem = order;
this.selItem = order;
}
}
import { Injectable } from '@angular/core';
import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/firestore';
import {
AngularFirestore,
AngularFirestoreCollection
} from '@angular/fire/firestore';
import { Search } from './services/search';
import { database } from 'firebase';
import { take } from 'rxjs/operators';
......@@ -9,26 +12,32 @@ import { take } from 'rxjs/operators';
})
export class SearchService {
searchList: Search[] = [];
constructor(
public afs: AngularFirestore
) {
}
constructor(public afs: AngularFirestore) {}
public async search(inputText: string) {
if (inputText === '') {
this.searchList = [];
return;
this.searchList = [];
return;
}
const This = this;
const state = true;
this.searchList = [];
// tslint:disable-next-line:max-line-length
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('shoppers', ref => ref.where('status', '==', state).orderBy('name').startAt(inputText).endAt(inputText + '\uf8ff').limit(5));
orderRef.valueChanges().subscribe((value) => {
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
'shoppers',
ref =>
ref
.where('status', '==', state)
.orderBy('name')
.startAt(inputText.toUpperCase())
.endAt(inputText.toLowerCase() + '\uf8ff')
.limit(5)
);
orderRef.valueChanges().subscribe(value => {
const res = value;
if (res.length > 0) {
res.forEach((item) => {
console.log(item);
res.forEach(item => {
// console.log(item);
const shopper: Search = {
text: item.name,
data: item,
......@@ -40,44 +49,57 @@ export class SearchService {
});
// tslint:disable-next-line:max-line-length
const prodRef: AngularFirestoreCollection<any> = this.afs.collection('products', ref => ref.where('status', '==', state).orderBy('prodName').startAt(inputText).endAt(inputText + '\uf8ff').limit(5));
prodRef.valueChanges().subscribe((values) => {
const result = values;
if (result.length > 0) {
result.forEach((item) => {
console.log(item);
const prod: Search = {
text: item.prodName,
data: item,
type: 'product'
};
this.searchList.push(prod);
});
console.log(this.searchList);
}
const prodRef: AngularFirestoreCollection<any> = this.afs.collection(
'products',
ref =>
ref
.where('status', '==', state)
.orderBy('prodName')
.startAt(inputText.toUpperCase())
.endAt(inputText.toLowerCase() + '\uf8ff')
.limit(5)
);
prodRef.valueChanges().subscribe(values => {
const result = values;
if (result.length > 0) {
result.forEach(item => {
console.log(item);
const prod: Search = {
text: item.prodName,
data: item,
type: 'product'
};
this.searchList.push(prod);
});
console.log(this.searchList);
}
});
// tslint:disable-next-line:max-line-length
const feaRef: AngularFirestoreCollection<any> = this.afs.collection('category', ref => ref.where('status', '==', state).orderBy('catName').startAt(inputText).endAt(inputText + '\uf8ff').limit(5));
feaRef.valueChanges().subscribe((values) => {
const result = values;
if (result.length > 0) {
result.forEach((item) => {
console.log(item);
const prod: Search = {
text: item.catName,
data: item,
type: 'category'
};
this.searchList.push(prod);
});
console.log(this.searchList);
}
const feaRef: AngularFirestoreCollection<any> = this.afs.collection(
'category',
ref =>
ref
.where('status', '==', state)
.orderBy('catName')
.startAt(inputText.toUpperCase())
.endAt(inputText.toLowerCase() + '\uf8ff')
.limit(5)
);
feaRef.valueChanges().subscribe(values => {
const result = values;
if (result.length > 0) {
result.forEach(item => {
console.log(item);
const prod: Search = {
text: item.catName,
data: item,
type: 'category'
};
this.searchList.push(prod);
});
console.log(this.searchList);
}
});
}
}
import { Injectable } from '@angular/core';
import { Storage } from '@ionic/storage';
import { Injectable } from "@angular/core";
import { Storage } from "@ionic/storage";
@Injectable({
providedIn: 'root'
providedIn: "root"
})
export class ServiceService {
state: boolean;
constructor(public storage: Storage) {
......@@ -13,20 +12,20 @@ export class ServiceService {
}
public set(settingName: string, value: any) {
return this.storage.set(`setting:${ settingName }`, value);
return this.storage.set(`setting:${settingName}`, value);
}
public async get(settingName: string) {
return await this.storage.get(`setting:${ settingName }`);
return await this.storage.get(`setting:${settingName}`);
}
public async remove(settingName: string) {
return await this.storage.remove(`setting:${ settingName }`);
return await this.storage.remove(`setting:${settingName}`);
}
public clear() {
this.storage.clear().then(() => {
console.log('all keys cleared');
console.log("all keys cleared");
});
}
......@@ -34,7 +33,7 @@ export class ServiceService {
const response = [];
for (const key in item) {
if (item.hasOwnProperty(key)) {
response.push(item[key]);
response.push(item[key]);
}
}
return response;
......@@ -44,12 +43,9 @@ export class ServiceService {
const response = [];
for (const key in item) {
if (item.hasOwnProperty(key)) {
response.push(key);
response.push(key);
}
}
return response;
}
}
export interface Slides {
downloadURL: string;
imageId: string;
path: string;
skuId: string;
}
export interface User {
uid: string;
emailId: string;
name: string;
phone: string;
phoneVerified: boolean;
profilePhoto: string;
emailVerified: boolean;
status: boolean;
loginType: number;
otp: string;
currency: {
currId: string;
currName: string;
symbol: string
};
uid: string;
emailId: string;
name: string;
phone: string;
phoneVerified: boolean;
profilePhoto: string;
emailVerified: boolean;
status: boolean;
loginType: number;
otp: string;
currency: {
currId: string;
currName: string;
symbol: string;
};
}
export interface Signup {
name: string;
emailId: string;
phone: string;
password: string;
dob: any;
terms: boolean;
name: string;
emailId: string;
phone: string;
password: string;
dob: any;
terms: boolean;
}
// Model for Change Details page
export interface UpdateUserDetails {
name: string;
emailId: string;
phone: string;
}
// Model to Update Password
export interface UpdateUserDetails {}
export interface Otp {
uid: string;
otp: number;
uid: string;
otp: number;
}
export interface Address {
addressType: string;
firstAddress: string;
secondAddress: string;
city: string;
state: string;
district: string;
landmark: string;
area: string;
zip: string;
country: string;
default: number;
addressType: string;
firstAddress: string;
secondAddress: string;
city: string;
state: string;
district: string;
landmark: string;
area: string;
zip: string;
country: string;
default: number;
}
import { Injectable } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/auth';
import { AngularFirestore, AngularFirestoreDocument, AngularFirestoreCollection } from '@angular/fire/firestore';
import { Shopper } from './services/shopper';
import * as firebase from 'firebase';
import { Injectable } from "@angular/core";
import { AngularFireAuth } from "@angular/fire/auth";
import {
AngularFirestore,
AngularFirestoreDocument,
AngularFirestoreCollection
} from "@angular/fire/firestore";
import { Shopper } from "./services/shopper";
import * as firebase from "firebase";
@Injectable({
providedIn: 'root'
providedIn: "root"
})
export class ShoppersService {
shoppers: Shopper[] = [];
activeshoppers: Shopper[] = [];
nearshoppers: Shopper[] = [];
constructor(
public afs: AngularFirestore,
public afAuth: AngularFireAuth,
) {
constructor(public afs: AngularFirestore, public afAuth: AngularFireAuth) {
this.featuredshopperList();
this.getNearBy(10.0159, 76.3419, 10);
}
......@@ -22,14 +23,16 @@ export class ShoppersService {
public async shopperList(centerId: string, type: string) {
const This = this;
const state = true;
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('shoppers', ref => ref.where(type, '==', centerId)
.where('status', '==', state));
orderRef.valueChanges().subscribe((value) => {
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"shoppers",
ref => ref.where(type, "==", centerId).where("status", "==", state)
);
orderRef.valueChanges().subscribe(value => {
this.shoppers = [];
const res = value;
if (res.length > 0) {
res.forEach((item) => {
console.log(item);
res.forEach(item => {
// console.log(item);
const shopper: Shopper = {
name: item.name,
emailId: item.emailId,
......@@ -39,7 +42,7 @@ export class ShoppersService {
status: item.status,
address: item.address,
featured: item.featured,
featuredImage: item.featuredImage,
featuredImage: item.featuredImage,
shopName: item.shopName,
shopStatus: item.shopStatus,
workingHours: item.workingHours,
......@@ -49,7 +52,7 @@ export class ShoppersService {
};
this.shoppers.push(shopper);
});
console.log(this.shoppers);
// console.log(this.shoppers);
} else {
// alert('No Orders Found');
}
......@@ -59,14 +62,16 @@ export class ShoppersService {
public async featuredshopperList() {
const This = this;
const state = true;
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('shoppers', ref => ref.where('featured', '==', state)
.where('status', '==', state));
orderRef.valueChanges().subscribe((value) => {
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"shoppers",
ref => ref.where("featured", "==", state).where("status", "==", state)
);
orderRef.valueChanges().subscribe(value => {
this.activeshoppers = [];
const res = value;
if (res.length > 0) {
res.forEach((item) => {
console.log(item);
res.forEach(item => {
// console.log(item);
const shopper: Shopper = {
name: item.name,
emailId: item.emailId,
......@@ -76,7 +81,7 @@ export class ShoppersService {
status: item.status,
address: item.address,
featured: item.featured,
featuredImage: item.featuredImage,
featuredImage: item.featuredImage,
shopName: item.shopName,
shopStatus: item.shopStatus,
workingHours: item.workingHours,
......@@ -86,7 +91,7 @@ export class ShoppersService {
};
this.activeshoppers.push(shopper);
});
console.log(this.activeshoppers);
// console.log(this.activeshoppers);
} else {
// alert('No Orders Found');
}
......@@ -100,22 +105,31 @@ export class ShoppersService {
const lat = 0.0144927536231884;
const lon = 0.0181818181818182;
const lowerLat = latitude - (lat * distance);
const lowerLon = longitude - (lon * distance);
const lowerLat = latitude - lat * distance;
const lowerLon = longitude - lon * distance;
const greaterLat = latitude + (lat * distance);
const greaterLon = longitude + (lon * distance);
const greaterLat = latitude + lat * distance;
const greaterLon = longitude + lon * distance;
const lesserGeopoint = new firebase.firestore.GeoPoint(lowerLat, lowerLon);
const greaterGeopoint = new firebase.firestore.GeoPoint(greaterLat, greaterLon);
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('shoppers', ref => ref.where('centre.latLng', '>', lesserGeopoint)
.where('centre.latLng', '<', greaterGeopoint).where('status', '==', state));
orderRef.valueChanges().subscribe((value) => {
const greaterGeopoint = new firebase.firestore.GeoPoint(
greaterLat,
greaterLon
);
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"shoppers",
ref =>
ref
.where("centre.latLng", ">", lesserGeopoint)
.where("centre.latLng", "<", greaterGeopoint)
.where("status", "==", state)
);
orderRef.valueChanges().subscribe(value => {
this.nearshoppers = [];
const res = value;
if (res.length > 0) {
res.forEach((item) => {
console.log(item);
res.forEach(item => {
// console.log(item);
const shopper: Shopper = {
name: item.name,
emailId: item.emailId,
......@@ -125,7 +139,7 @@ export class ShoppersService {
status: item.status,
address: item.address,
featured: item.featured,
featuredImage: item.featuredImage,
featuredImage: item.featuredImage,
shopName: item.shopName,
shopStatus: item.shopStatus,
workingHours: item.workingHours,
......@@ -135,12 +149,10 @@ export class ShoppersService {
};
this.nearshoppers.push(shopper);
});
console.log(this.nearshoppers);
// console.log(this.nearshoppers);
} else {
// alert('No Orders Found');
}
});
}
}
import { Injectable } from "@angular/core";
import { User, UpdateUserDetails, Address } 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";
@Injectable({
providedIn: "root"
})
export class UpdateService {
userData: any;
type: number;
userPostData: any;
updateStatus: number;
constructor(
public afs: AngularFirestore,
public afAuth: AngularFireAuth,
private router: Router,
private service: ServiceService
) {
// this.type = 1;
// this.afAuth.authState.subscribe(user => {
// if (user) {
// this.userData = user;
// console.log(this.userData);
// this.service.set("user", JSON.stringify(this.userData));
// if (this.type === 1) {
// this.router.navigateByUrl("home");
// } else {
// this.router.navigateByUrl("verification");
// }
// } else {
// this.service.set("user", null);
// JSON.parse(localStorage.getItem("user"));
// this.router.navigateByUrl("login");
// }
// });
}
updateData(userData: UpdateUserDetails, uid: string) {
this.type = 2;
const postData: UpdateUserDetails = {
phone: userData.phone,
name: userData.name,
emailId: userData.emailId
};
this.userPostData = postData;
this.afs
.collection("customers")
.doc(uid)
.update(postData)
.then(() => {
console.log("success");
this.router.navigateByUrl("profile");
})
.catch(error => {
console.log(error);
});
}
}
import { Injectable } from "@angular/core";
import { AngularFireAuth } from "@angular/fire/auth";
import {
AngularFirestore,
AngularFirestoreDocument,
AngularFirestoreCollection
} from "@angular/fire/firestore";
import * as firebase from "firebase";
import { User } from "./services/user";
@Injectable({
providedIn: "root"
})
// Gets User Details
export class UserService {
users: User;
constructor(public afs: AngularFirestore, public afAuth: AngularFireAuth) {}
public async getUserData(userId: string) {
const This = this;
const state = true;
// Get User Query
const userRef: AngularFirestoreCollection<any> = this.afs.collection(
"customers",
ref => ref.where("uid", "==", userId).where("status", "==", state)
);
userRef.valueChanges().subscribe(value => {
const res = value;
if (res.length > 0) {
const item = res[0];
this.users = {
name: item.name,
emailId: item.emailId,
phone: item.phone,
uid: item.uid,
profilePhoto: item.profilePic,
status: item.status,
phoneVerified: item.phoneVerified,
emailVerified: item.emailVerified,
loginType: 0,
otp: "",
currency: {
currId: "",
currName: "",
symbol: ""
}
};
}
// return this.users;
});
}
}
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