Commit 1e6f206d by Adarsh K

getmi

parent b0bde269
...@@ -13,26 +13,17 @@ ...@@ -13,26 +13,17 @@
<ion-grid *ngFor="let address of addressService.addressList; let i = index"> <ion-grid *ngFor="let address of addressService.addressList; let i = index">
<ion-row> <ion-row>
<ion-col size="1"> <ion-col size="1">
<input <input type="radio" id="address_{{i}}" class="address-radio" name="address"
type="radio" (change)="setDefault(address.addressId)" [checked]="address.defaultVal == 1" />
id="address_{{i}}"
class="address-radio"
name="address"
[checked]="address.defaultVal == 1"
/>
</ion-col> </ion-col>
<ion-col size="9"> <ion-col size="9">
<h1>{{address.addressType}}</h1> <h1>{{address.addressType}}</h1>
<h1>{{address.address}}</h1> <h1>{{address.address}}</h1>
<p>{{address.building}}, {{address.landmark}}</p> <p>{{address.building}}, {{address.landmark}}</p>
</ion-col> </ion-col>
<ion-col size="2" [hidden]="address.defaultVal == 1" <ion-col size="2" [hidden]="address.defaultVal == 1"><button class="show-btn"
><button (click)="addressService.deleteAddress(address.addressId)">
class="show-btn" <img src="../../assets/delete.png" /></button></ion-col>
(click)="addressService.deleteAddress(address.addressId)"
>
<img src="../../assets/delete.png" /></button
></ion-col>
</ion-row> </ion-row>
</ion-grid> </ion-grid>
<div class="address-btn-wrapper"> <div class="address-btn-wrapper">
...@@ -42,3 +33,9 @@ ...@@ -42,3 +33,9 @@
</div> </div>
</div> </div>
</ion-content> </ion-content>
<div class="loader" *ngIf="loader">
<div class="lds-ripple">
<div></div>
<div></div>
</div>
</div>
\ No newline at end of file
...@@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core'; ...@@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core';
import { AddressService } from './../../config/address.service'; import { AddressService } from './../../config/address.service';
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { ServiceService } from './../../config/service.service';
@Component({ @Component({
selector: 'app-address', selector: 'app-address',
...@@ -9,18 +11,41 @@ import { Location } from '@angular/common'; ...@@ -9,18 +11,41 @@ import { Location } from '@angular/common';
styleUrls: ['./address.page.scss'] styleUrls: ['./address.page.scss']
}) })
export class AddressPage implements OnInit { export class AddressPage implements OnInit {
custId: any;
loader: boolean;
constructor( constructor(
private location: Location, private location: Location,
public addressService: AddressService, public addressService: AddressService,
public router: Router public router: Router,
) {} public service: ServiceService,
) {
this.loader = false;
const users = this.service.get('user').then(data => {
if (data) {
data = JSON.parse(data);
this.custId = data.uid;
this.addressService.addList(data.uid);
}
});
}
ngOnInit() {} ngOnInit() { }
goBack() { goBack() {
this.location.back(); this.location.back();
} }
setDefault(addressId: any) {
this.loader = true;
console.log(addressId);
this.addressService.setDefaultAddress(addressId, this.custId).then(() => {
this.loader = false;
}).catch(err => {
this.loader = false;
this.service.showToast('Something went wrong please try again!', 'top', 'my-error', 1000);
});
}
goToPage(path, data = null) { goToPage(path, data = null) {
this.router.navigateByUrl(path, { queryParams: data }); this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0; document.body.scrollTop = document.documentElement.scrollTop = 0;
......
...@@ -3,7 +3,7 @@ import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; ...@@ -3,7 +3,7 @@ import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
const routes: Routes = [ const routes: Routes = [
{ {
path: '', path: 'landing',
loadChildren: './landing/landing.module#LandingPageModule' loadChildren: './landing/landing.module#LandingPageModule'
}, },
{ path: 'tabs', loadChildren: './tabs/tabs.module#TabsPageModule' }, { path: 'tabs', loadChildren: './tabs/tabs.module#TabsPageModule' },
...@@ -124,7 +124,9 @@ const routes: Routes = [ ...@@ -124,7 +124,9 @@ const routes: Routes = [
{ {
path: 'changeaddress', path: 'changeaddress',
loadChildren: './changeaddress/changeaddress.module#ChangeaddressPageModule' loadChildren: './changeaddress/changeaddress.module#ChangeaddressPageModule'
} },
{ path: '', loadChildren: './firstpage/firstpage.module#FirstpagePageModule' }
]; ];
@NgModule({ @NgModule({
imports: [ imports: [
...@@ -132,4 +134,4 @@ const routes: Routes = [ ...@@ -132,4 +134,4 @@ const routes: Routes = [
], ],
exports: [RouterModule] exports: [RouterModule]
}) })
export class AppRoutingModule {} export class AppRoutingModule { }
...@@ -117,7 +117,8 @@ export class AppComponent { ...@@ -117,7 +117,8 @@ export class AppComponent {
'trackorder', 'trackorder',
'changeaddress', 'changeaddress',
'changedetails', 'changedetails',
'contact' 'contact',
'myorder'
]; ];
const currentUrl = this.router.url.split('/'); const currentUrl = this.router.url.split('/');
const index = restrictedUrl.findIndex(x => x === currentUrl[1]); const index = restrictedUrl.findIndex(x => x === currentUrl[1]);
......
...@@ -198,9 +198,7 @@ export class CartPage implements OnInit { ...@@ -198,9 +198,7 @@ export class CartPage implements OnInit {
} }
getDeliveryTime(timeStamp) { getDeliveryTime(timeStamp) {
console.log(timeStamp);
const endDate = new Date(timeStamp * 1000); const endDate = new Date(timeStamp * 1000);
console.log(endDate);
endDate.setHours(endDate.getHours() + 1); endDate.setHours(endDate.getHours() + 1);
const t = this.getTimeRemaining(endDate, new Date()); const t = this.getTimeRemaining(endDate, new Date());
const minutes = t.minutes < 10 ? '0' + t.minutes : t.minutes; const minutes = t.minutes < 10 ? '0' + t.minutes : t.minutes;
......
...@@ -115,30 +115,31 @@ export class ChangeaddressPage implements OnInit { ...@@ -115,30 +115,31 @@ export class ChangeaddressPage implements OnInit {
onSubmit(data: any) { onSubmit(data: any) {
this.loader = true; this.loader = true;
console.log(data); this.service.get('orderId').then((orderId) => {
const postData: Address = { const postData: Address = {
address: this.address, address: this.address,
addressType: data.addressType, addressType: data.addressType,
building: data.building, building: data.building,
landmark: data.landmark, landmark: data.landmark,
defaultVal: 0, defaultVal: 0,
uid: this.uid, uid: this.uid,
latLng: new firebase.firestore.GeoPoint(this.latitude, this.longitude), latLng: new firebase.firestore.GeoPoint(this.latitude, this.longitude),
status: true status: true
}; };
this.addressService.addressCreate(postData); console.log(postData, orderId);
this.successState = true; this.addressService.changeAddress(postData, orderId);
this.service.get('order').then(val => {
val.deliveryAddress = postData;
this.service.set('order', val);
});
this.successState = true;
setTimeout(() => { setTimeout(() => {
this.loader = false; this.loader = false;
this.successState = false; this.successState = false;
if (this.type === 1) {
this.service.set('type', 0);
this.router.navigateByUrl('home', { queryParams: null });
} else {
this.goBack(); this.goBack();
} }, 3000);
}, 3000); });
} }
} }
......
...@@ -14,48 +14,21 @@ ...@@ -14,48 +14,21 @@
<h6>Personal Details</h6> <h6>Personal Details</h6>
</div> </div>
<div class="row"> <div class="row">
<input <input [(value)]="userData && userData.name" name="name" readonly class="" type="text"
[(value)]="userData && userData.name" [(ngModel)]="userData && userData.name" placeholder="Change your Name" #name="ngModel" />
name="name" <div class="md-errors-spacer" [hidden]="name.valid" class="ion-padding-start">
required
class=""
type="text"
[(ngModel)]="userData && userData.name"
placeholder="Change your Name"
#name="ngModel"
/>
<div
class="md-errors-spacer"
[hidden]="name.valid"
class="ion-padding-start"
>
Name is required Name is required
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<input <input [(value)]="userData && userData.emailId" readonly class="" name="emailId" type="mail"
[(value)]="userData && userData.emailId" placeholder="email cannot be changed" />
readonly
class=""
name="emailId"
type="mail"
placeholder="email cannot be changed"
/>
</div> </div>
<div class="row"> <div class="row">
<input <input [(value)]="userData && userData.phone" required class="" name="phone" type="number"
[(value)]="userData && userData.phone" pattern="(\(+61\)|\+61|\(0[1-9]\)|0[1-9])?( ?-?[0-9]){6,9}" maxlength="10"
required [(ngModel)]="userData && userData.phone" placeholder="Change your Phone Number" #phone="ngModel" />
class=""
name="phone"
type="number"
pattern="(\(+61\)|\+61|\(0[1-9]\)|0[1-9])?( ?-?[0-9]){6,9}"
maxlength="10"
[(ngModel)]="userData && userData.phone"
placeholder="Change your Phone Number"
#phone="ngModel"
/>
<div class="md-errors-spacer" [hidden]="phone.valid"> <div class="md-errors-spacer" [hidden]="phone.valid">
<div *ngIf="phone.errors && phone.errors.required"> <div *ngIf="phone.errors && phone.errors.required">
Phone number is required Phone number is required
...@@ -70,60 +43,30 @@ ...@@ -70,60 +43,30 @@
<h6>Change Password</h6> <h6>Change Password</h6>
</div> </div>
<div class="row"> <div class="row">
<input <input class="" type="password" minlength="6" #currentPassword="ngModel"
class="" [(ngModel)]="updatePassword.currentPassword" name="currentPassword" placeholder="Current Password" />
type="password" <div *ngIf="currentPassword.errors && currentPassword.errors.minlength">
minlength="6"
#currentPassword="ngModel"
[(ngModel)]="updatePassword.currentPassword"
name="currentPassword"
placeholder="Current Password"
/>
<div
*ngIf="currentPassword.errors && currentPassword.errors.minlength"
>
Password must be at least 6 characters Password must be at least 6 characters
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<input <input class="" [(ngModel)]="updatePassword.password" name="password" type="password"
class="" placeholder="New Password" minlength="6" [required]="currentPassword ? true: false" #password="ngModel" />
[(ngModel)]="updatePassword.password"
name="password"
type="password"
placeholder="New Password"
minlength="6"
[required]="currentPassword ? true: false"
#password="ngModel"
/>
<div *ngIf="password.errors && password.errors.minlength"> <div *ngIf="password.errors && password.errors.minlength">
Password must be at least 6 characters Password must be at least 6 characters
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<input <input class="" #confirmPassword="ngModel" [(ngModel)]="updatePassword.confirmPassword" name="confirmPassword"
class="" type="password" [required]="currentPassword ? true: false" placeholder="Confirm Password" />
#confirmPassword="ngModel" <div *ngIf="confirmPassword.value !=='' && confirmPassword.value !== password.value">
[(ngModel)]="updatePassword.confirmPassword"
name="confirmPassword"
type="password"
[required]="currentPassword ? true: false"
placeholder="Confirm Password"
/>
<div
*ngIf="confirmPassword.value !=='' && confirmPassword.value !== password.value"
>
Password should match Password should match
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<button <button class="login_btn" (click)="onFormSubmit(updateForm)" [disabled]="!phone.valid || !name.valid">
class="login_btn"
(click)="onFormSubmit(updateForm)"
[disabled]="!phone.valid || !name.valid"
>
UPDATE UPDATE
</button> </button>
</div> </div>
...@@ -136,4 +79,4 @@ ...@@ -136,4 +79,4 @@
<div></div> <div></div>
<div></div> <div></div>
</div> </div>
</div> </div>
\ No newline at end of file
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { FirstpagePage } from './firstpage.page';
const routes: Routes = [
{
path: '',
component: FirstpagePage
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild(routes)
],
declarations: [FirstpagePage]
})
export class FirstpagePageModule {}
<ion-content>
</ion-content>
\ No newline at end of file
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FirstpagePage } from './firstpage.page';
describe('FirstpagePage', () => {
let component: FirstpagePage;
let fixture: ComponentFixture<FirstpagePage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FirstpagePage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(FirstpagePage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { SubjectService } from './../../config/subject.service';
import { ServiceService } from './../../config/service.service';
import { Router, ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-firstpage',
templateUrl: './firstpage.page.html',
styleUrls: ['./firstpage.page.scss'],
})
export class FirstpagePage implements OnInit {
loader: boolean;
constructor(
private subjectService: SubjectService,
private service: ServiceService,
private router: Router,
) {
this.loader = true;
this.service.get('landing').then(data => {
if (data === true) {
const user = JSON.parse(localStorage.getItem('user'));
console.log(user);
if (user) {
this.subjectService.sendLoginData(false);
this.goToPage('home');
} else {
this.subjectService.sendLoginData(true);
this.goToPage('login');
}
} else {
this.goToPage('landing');
}
this.loader = false;
});
}
goToPage(path, data = null) {
this.router.navigateByUrl(path, { replaceUrl: true, queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
ngOnInit() {
}
}
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
<h5>{{center.centerName}}</h5> <h5>{{center.centerName}}</h5>
<p>{{center.description}}</p> <p>{{center.description}}</p>
</div> </div>
<img [src]="center.centerImg" onerror="this.src='./../../assets/getmi_malls/mall_banner/mall_4.png'" /> <img [src]="center.centerImg"
onerror="this.src='./../../assets/getmi_malls/mall_banner/mall_4.png'" />
</ion-slide> </ion-slide>
</ion-slides> </ion-slides>
</div> </div>
...@@ -39,10 +40,12 @@ ...@@ -39,10 +40,12 @@
Featured Stores Featured Stores
</div> </div>
<div class="featured_slider"> <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"> <ion-slide *ngFor="let shopper of shopperService.activeshoppers">
<div class="feature_product" (click)="goToPage('productlist', shopper)"> <div class="feature_product" (click)="goToPage('productlist', shopper)">
<img [src]="shopper.featuredImage" onerror="this.src='./../../assets/getmi_malls/featured/featured1.png'" /> <img [src]="shopper.featuredImage"
onerror="this.src='./../../assets/getmi_malls/featured/featured1.png'" />
<div class="feature_overlay"> <div class="feature_overlay">
<h5>{{shopper.name}}</h5> <h5>{{shopper.name}}</h5>
<p>{{shopper.caption}}</p> <p>{{shopper.caption}}</p>
...@@ -63,22 +66,23 @@ ...@@ -63,22 +66,23 @@
<div class="home_sub_header"> <div class="home_sub_header">
<span class="floatLeft">Nearby Shopping Centers</span> <span class="floatLeft">Nearby Shopping Centers</span>
<span class="floatRight"> <span class="floatRight">
<div class="nearby_icon" (click)="goToPage('nearby')"></div> <div class="nearby_icon" (click)="goToPage('nearby')"></div>
</span> </span>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="nearby_shop_list"> <div class="nearby_shop_list">
<ul *ngIf="centerService.nearcenters && centerService.nearcenters.length > 0"> <ul *ngIf="centerService.nearcenters && centerService.nearcenters.length > 0">
<li *ngFor="let center of centerService.nearcenters" (click)="goToPage('storelist', center)"> <li *ngFor="let center of centerService.nearcenters" (click)="goToPage('storelist', center)">
<div class="nearby_image"> <div class="nearby_image">
<img [src]="center.centerImg" onerror="this.src='./../../assets/getmi_malls/mall_298/mall2.png'" /> <img [src]="center.centerImg"
onerror="this.src='./../../assets/getmi_malls/mall_298/mall2.png'" />
</div> </div>
<div class="nearby_detail"> <div class="nearby_detail">
<h5> <h5>
<span class="floatLeft">{{center.centerName}}</span> <span class="floatLeft">{{center.centerName}}</span>
<span class="floatRight">0 <span class="floatRight">0
<img src="../assets/Path61_2.png" /> <img src="../assets/Path61_2.png" />
</span> </span>
<div class="clear"></div> <div class="clear"></div>
</h5> </h5>
<p>{{center.description}}</p> <p>{{center.description}}</p>
...@@ -92,8 +96,10 @@ ...@@ -92,8 +96,10 @@
</div> </div>
<div class="featured_catagory_list"> <div class="featured_catagory_list">
<ul *ngIf="categoriesService.activecategories && categoriesService.activecategories.length > 0"> <ul *ngIf="categoriesService.activecategories && categoriesService.activecategories.length > 0">
<li *ngFor="let categories of categoriesService.activecategories" (click)="goToPage('catstorelist', categories)"> <li *ngFor="let categories of categoriesService.activecategories"
<img [src]="categories.catImage" onerror="this.src='../assets/handsome-man-outdoors-drinking-coffee-with-sunglasses-guy-with-beard-instagram-effect_1212-818@3x.png'" /> (click)="goToPage('catstorelist', categories)">
<img [src]="categories.catImage"
onerror="this.src='../assets/handsome-man-outdoors-drinking-coffee-with-sunglasses-guy-with-beard-instagram-effect_1212-818@3x.png'" />
<div class="featured_overlay"> <div class="featured_overlay">
<h4>{{categories.catName}}</h4> <h4>{{categories.catName}}</h4>
</div> </div>
...@@ -105,15 +111,16 @@ ...@@ -105,15 +111,16 @@
<div *ngIf="isShow" [@slideInOut]> <div *ngIf="isShow" [@slideInOut]>
<div class="nav_header"> <div class="nav_header">
<button class="nav_btn nav_back floatLeft" (click)="istoggle()"> <button class="nav_btn nav_back floatLeft" (click)="istoggle()">
<img src="../assets/Group17_2.png" /> <img src="../assets/Group17_2.png" />
</button> </button>
<div class="nav_title floatLeft"> <div class="nav_title floatLeft">
<h4>CHANGE LOCATION</h4> <h4>CHANGE LOCATION</h4>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<ion-content class="sort_wrappper"> <ion-content class="sort_wrappper">
<agm-map [zoom]="20" [latitude]="lat" [longitude]="lng" [disableDefaultUI]="false" [zoomControl]="false" [backgroundColor]="'rgba(29, 27, 130,0.2)'"> <agm-map [zoom]="20" [latitude]="lat" [longitude]="lng" [disableDefaultUI]="false" [zoomControl]="false"
[backgroundColor]="'rgba(29, 27, 130,0.2)'">
<agm-marker [latitude]="lat" [longitude]="lng"></agm-marker> <agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
</agm-map> </agm-map>
<div class="add_address_wrapper"> <div class="add_address_wrapper">
...@@ -126,10 +133,12 @@ ...@@ -126,10 +133,12 @@
<li *ngFor="let address of addressService.addressList; let i = index"> <li *ngFor="let address of addressService.addressList; let i = index">
<div class="floatLeft"> <div class="floatLeft">
{{address.default}} {{address.default}}
<input class="styled-checkbox" name="addressId" id="styled-checkbox-{{i}}" type="radio" (click)="setDefault(address.addressId)" [value]="address.addressId" #addressType [checked]="address.defaultVal == 1" /> <input class="styled-checkbox" name="addressId" id="styled-checkbox-{{i}}" type="radio"
(click)="setDefault(address.addressId)" [value]="address.addressId" #addressType
[checked]="address.defaultVal == 1" />
<label for="styled-checkbox-{{i}}"> <label for="styled-checkbox-{{i}}">
{{address.addressType}} {{address.addressType}}
</label> </label>
</div> </div>
<div class="floatLeft"> <div class="floatLeft">
<p> <p>
...@@ -141,5 +150,11 @@ ...@@ -141,5 +150,11 @@
</ul> </ul>
</div> </div>
</div> </div>
<div class="loader" *ngIf="loader">
<div class="lds-ripple">
<div></div>
<div></div>
</div>
</div>
</ion-content> </ion-content>
</div> </div>
\ No newline at end of file
...@@ -37,6 +37,7 @@ export class HomePage implements OnInit { ...@@ -37,6 +37,7 @@ export class HomePage implements OnInit {
searchShow = false; searchShow = false;
public lat = 51.678418; public lat = 51.678418;
public lng = 7.809007; public lng = 7.809007;
loader: boolean;
address: any; address: any;
custId: any; custId: any;
private geoCoder; private geoCoder;
...@@ -59,7 +60,9 @@ export class HomePage implements OnInit { ...@@ -59,7 +60,9 @@ export class HomePage implements OnInit {
private searchService: SearchService, private searchService: SearchService,
private productsService: ProductsService, private productsService: ProductsService,
private subjectService: SubjectService private subjectService: SubjectService
) {} ) {
this.loader = false;
}
ngOnInit() { ngOnInit() {
this.mapsAPILoader.load().then(() => { this.mapsAPILoader.load().then(() => {
...@@ -110,7 +113,13 @@ export class HomePage implements OnInit { ...@@ -110,7 +113,13 @@ export class HomePage implements OnInit {
} }
setDefault(addressId: any) { setDefault(addressId: any) {
this.addressService.setDefaultAddress(addressId, this.custId); this.loader = true;
this.addressService.setDefaultAddress(addressId, this.custId).then(() => {
this.loader = false;
}).catch(err => {
this.loader = false;
this.service.showToast('Something went wrong please try again!', 'top', 'my-error', 1000);
});
} }
clickSearch() { clickSearch() {
......
...@@ -17,21 +17,6 @@ export class LandingPage implements OnInit { ...@@ -17,21 +17,6 @@ export class LandingPage implements OnInit {
private service: ServiceService, private service: ServiceService,
public subjectService: SubjectService public subjectService: SubjectService
) { ) {
this.loader = true;
this.service.get('landing').then(data => {
if (data === true) {
const user = JSON.parse(localStorage.getItem('user'));
console.log(user);
if (user) {
this.subjectService.sendLoginData(false);
this.goToPage('home');
} else {
this.subjectService.sendLoginData(true);
this.goToPage('login');
}
}
this.loader = false;
});
} }
slideOpts = { slideOpts = {
...@@ -49,11 +34,11 @@ export class LandingPage implements OnInit { ...@@ -49,11 +34,11 @@ export class LandingPage implements OnInit {
allowTouchMove: true allowTouchMove: true
}; };
ngOnInit() {} ngOnInit() { }
goToPage(path, data = null) { goToPage(path, data = null) {
this.service.set('landing', true); this.service.set('landing', true);
this.router.navigateByUrl(path, { queryParams: data }); this.router.navigateByUrl(path, { replaceUrl: true, queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0; document.body.scrollTop = document.documentElement.scrollTop = 0;
} }
......
...@@ -15,16 +15,16 @@ export class LoginPage implements OnInit { ...@@ -15,16 +15,16 @@ export class LoginPage implements OnInit {
private route: ActivatedRoute, private route: ActivatedRoute,
public authService: AuthService, public authService: AuthService,
public menuCtrl: MenuController public menuCtrl: MenuController
) {} ) { }
ngOnInit() {} ngOnInit() { }
ionViewWillEnter() { ionViewWillEnter() {
this.menuCtrl.enable(false); this.menuCtrl.enable(false);
} }
goToPage(path, data = null) { goToPage(path, data = null) {
this.router.navigateByUrl(path, { queryParams: data }); this.router.navigateByUrl(path, { replaceUrl: true, queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0; document.body.scrollTop = document.documentElement.scrollTop = 0;
} }
} }
...@@ -11,11 +11,8 @@ ...@@ -11,11 +11,8 @@
<li *ngFor="let order of myorder.orders; let i = index"> <li *ngFor="let order of myorder.orders; let i = index">
<div class="order_info"> <div class="order_info">
<h5 class="floatLeft">{{order.orderCode}}</h5> <h5 class="floatLeft">{{order.orderCode}}</h5>
<button <button class="order_track floatRight" *ngIf="order.orderStatus >= 3 && order.orderStatus < 7"
class="order_track floatRight" (click)="orderDetails(i)">
*ngIf="order.orderStatus >= 3 && order.orderStatus < 7"
(click)="orderDetails(i)"
>
Track Order Track Order
</button> </button>
<div class="clear"></div> <div class="clear"></div>
...@@ -28,25 +25,19 @@ ...@@ -28,25 +25,19 @@
<h5 class="floatLeft">{{product.prodName}}</h5> <h5 class="floatLeft">{{product.prodName}}</h5>
<div class="clear"></div> <div class="clear"></div>
<h5> <h5>
<span *ngIf="product.color !== 'No-Color'" <span *ngIf="product.color !== 'No-Color'">{{product.color}},
>{{product.color}},
</span> </span>
<span *ngIf="product.size !== 'Any-Size'">{{product.size}}</span <span *ngIf="product.size !== 'Any-Size'">{{product.size}}</span>&nbsp;<span>{{product.qty}}</span>
>&nbsp;<span>{{product.qty}}</span>
</h5> </h5>
<p>A$ {{product.price}}</p> <p *ngIf="product.price">A$ {{product.price}}</p>
</div> </div>
<div class="order_other"> <div class="order_other">
<h6 class="floatRight"> <h6 class="floatRight">
{{ order.bookDate.seconds * 1000 | date:'MMMM dd, y' }} {{ order.bookDate.seconds * 1000 | date:'MMMM dd, y' }}
</h6> </h6>
<span <span class="floatRight" *ngIf="order.orderStatus < 3 || order.orderStatus >= 7"
class="floatRight" (click)="acceptOrder(order)">{{getStatus(order.orderStatus)}}</span>
*ngIf="order.orderStatus < 3 || order.orderStatus >= 7"
(click)="acceptOrder(order)"
>{{getStatus(order.orderStatus)}}</span
>
<div class="clear"></div> <div class="clear"></div>
<!-- <button class="track_btn" *ngIf="order.orderStatus >= 3 && order.orderStatus < 7" (click)="orderDetails(i)">TRACK</button> --> <!-- <button class="track_btn" *ngIf="order.orderStatus >= 3 && order.orderStatus < 7" (click)="orderDetails(i)">TRACK</button> -->
<div class="clear"></div> <div class="clear"></div>
...@@ -121,4 +112,4 @@ ...@@ -121,4 +112,4 @@
<div></div> <div></div>
<div></div> <div></div>
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -13,7 +13,7 @@ import { ServiceService } from './../../config/service.service'; ...@@ -13,7 +13,7 @@ import { ServiceService } from './../../config/service.service';
}) })
export class MyorderPage implements OnInit { export class MyorderPage implements OnInit {
loader = false; loader = false;
userData: any;
constructor( constructor(
private router: Router, private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
...@@ -29,7 +29,14 @@ export class MyorderPage implements OnInit { ...@@ -29,7 +29,14 @@ export class MyorderPage implements OnInit {
setTimeout(() => { setTimeout(() => {
This.loader = false; This.loader = false;
}, 500); }, 500);
// this.myorder.orderList('WwHnLICVY2dvZGUHuKqasiTB91a2'); this.service.get('user').then(data => {
if (data) {
this.userData = JSON.parse(data);
console.log(this.userData.uid);
this.myorder.orderList(this.userData.uid);
}
});
} }
async finishpop(data: any) { async finishpop(data: any) {
...@@ -50,9 +57,9 @@ export class MyorderPage implements OnInit { ...@@ -50,9 +57,9 @@ export class MyorderPage implements OnInit {
} }
orderDetails(index: number) { orderDetails(index: number) {
this.myorder.trackOrder(this.myorder.orders[index]); this.myorder.trackOrder(this.myorder.orders[index]);
this.router.navigateByUrl('trackorder'); this.router.navigateByUrl('trackorder');
document.body.scrollTop = document.documentElement.scrollTop = 0; document.body.scrollTop = document.documentElement.scrollTop = 0;
} }
acceptOrder(order: any) { acceptOrder(order: any) {
......
...@@ -59,16 +59,12 @@ ...@@ -59,16 +59,12 @@
<ul> <ul>
<li (click)="goToPage('productlist')"> <li (click)="goToPage('productlist')">
<div class="nearby_image"> <div class="nearby_image">
<img <img [src]="data.product[0].image" onerror="this.src='../assets/[email protected]'" />
[src]="data.product[0].image"
onerror="this.src='../assets/[email protected]'"
/>
</div> </div>
<div class="nearby_detail"> <div class="nearby_detail">
<h5> <h5>
<span class="floatLeft">{{data.shopperName}}</span> <span class="floatLeft">{{data.shopperName}}</span>
<span class="floatRight" <span class="floatRight">{{data.product[0].qty}}
>{{data.product[0].qty}}
<img src="../assets/Path61_2.png" /> <img src="../assets/Path61_2.png" />
</span> </span>
<div class="clear"></div> <div class="clear"></div>
...@@ -86,8 +82,7 @@ ...@@ -86,8 +82,7 @@
</h6> </h6>
<h5>Quantity : <span>{{product.qty}}</span></h5> <h5>Quantity : <span>{{product.qty}}</span></h5>
<h5> <h5>
Amount : <strong>A$ {{product.price}}</strong Amount : <strong>A$ {{product.price}}</strong><span class="afterpay">COD</span>
><span class="afterpay">COD</span>
</h5> </h5>
<h5 *ngIf="data.orderStatus >= 3 && data.orderStatus < 7"> <h5 *ngIf="data.orderStatus >= 3 && data.orderStatus < 7">
Delivery time : <span>{{deliveryTime}}</span> Delivery time : <span>{{deliveryTime}}</span>
...@@ -95,12 +90,8 @@ ...@@ -95,12 +90,8 @@
<h5>Order Status : <span>{{getStatus(data.orderStatus)}}</span></h5> <h5>Order Status : <span>{{getStatus(data.orderStatus)}}</span></h5>
<div class="delivery-wrap"> <div class="delivery-wrap">
<h4 class="floatLeft">DELIVERY</h4> <h4 class="floatLeft">DELIVERY</h4>
<span class="floatRight" <span class="floatRight" *ngIf="cancelDelivery > 0 && data.orderStatus != 0 && data.orderStatus != 8"><img
><img class="ng-tns-c3-0" src="../../assets/edit.png" (click)="changeAddress(data.orderId)" /></span>
class="ng-tns-c3-0"
src="../../assets/edit.png"
(click)="goToPage('changeaddress')"
/></span>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
...@@ -110,11 +101,8 @@ ...@@ -110,11 +101,8 @@
{{data.deliveryAddress.building}}, <br /> {{data.deliveryAddress.building}}, <br />
{{data.deliveryAddress.landmark}} {{data.deliveryAddress.landmark}}
</h5> </h5>
<button <button class="cancel_btn" (click)="goToPage('contact')"
class="cancel_btn" *ngIf="cancelDelivery > 0 && data.orderStatus != 0 && data.orderStatus != 8">
(click)="goToPage('contact')"
*ngIf="cancelDelivery > 0 && data.orderStatus != 0 && data.orderStatus != 8"
>
CANCEL THIS ORDER CANCEL THIS ORDER
</button> </button>
<!-- <hr /> --> <!-- <hr /> -->
...@@ -176,4 +164,4 @@ ...@@ -176,4 +164,4 @@
</ul> </ul>
</div> --> </div> -->
</div> </div>
</ion-content> </ion-content>
\ No newline at end of file
...@@ -20,6 +20,18 @@ export class OrderplacedPage implements OnInit { ...@@ -20,6 +20,18 @@ export class OrderplacedPage implements OnInit {
private service: ServiceService, private service: ServiceService,
private myOrder: MyordersService private myOrder: MyordersService
) { ) {
}
data: any;
relatedProd = {
slidesPerView: 2
};
ionViewWillEnter() {
this.deliveryTime = ''; this.deliveryTime = '';
this.service.get('order').then(val => { this.service.get('order').then(val => {
this.data = val; this.data = val;
...@@ -28,16 +40,11 @@ export class OrderplacedPage implements OnInit { ...@@ -28,16 +40,11 @@ export class OrderplacedPage implements OnInit {
}, 1000); }, 1000);
}); });
} }
data: any;
relatedProd = {
slidesPerView: 2
};
getDeliveryTime(timeStamp) { getDeliveryTime(timeStamp) {
console.log(timeStamp); // console.log(timeStamp);
const endDate = new Date(timeStamp * 1000); const endDate = new Date(timeStamp * 1000);
console.log(endDate); // console.log(endDate);
endDate.setHours(endDate.getHours() + 1); endDate.setHours(endDate.getHours() + 1);
const t = this.getTimeRemaining(endDate, new Date()); const t = this.getTimeRemaining(endDate, new Date());
const minutes = t.minutes < 10 ? '0' + t.minutes : t.minutes; const minutes = t.minutes < 10 ? '0' + t.minutes : t.minutes;
...@@ -60,13 +67,19 @@ export class OrderplacedPage implements OnInit { ...@@ -60,13 +67,19 @@ export class OrderplacedPage implements OnInit {
}; };
} }
ngOnInit() {} ngOnInit() { }
goToPage(path, data = null) { goToPage(path, data = null) {
this.router.navigateByUrl(path, { queryParams: data }); this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0; document.body.scrollTop = document.documentElement.scrollTop = 0;
} }
changeAddress(orderId) {
this.service.set('orderId', orderId);
this.router.navigateByUrl('changeaddress');
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
goBack() { goBack() {
this.location.back(); this.location.back();
} }
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<div class="product_header"> <div class="product_header">
<ion-row> <ion-row>
<ion-col size="8"> <ion-col size="8">
<h3>{{product.prodName}}</h3> <h3>{{unEscape(product.prodName)}}</h3>
<p> <p>
<strong><span><img src="../assets/Path61_2.png" /></span>{{product.rating}}</strong>&nbsp; <strong><span><img src="../assets/Path61_2.png" /></span>{{product.rating}}</strong>&nbsp;
{{product.category}}, {{product.subCate}} {{product.category}}, {{product.subCate}}
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
</ul> </ul>
</div> --> </div> -->
<h5>Description</h5> <h5>Description</h5>
<p>{{product.prodDesc}}</p> <p>{{unEscape(product.prodDesc)}}</p>
<!--<h5> <!--<h5>
<span class="floatLeft">Reviews</span><span class="floatRight" (click)="goToPage('reviewlist')">MORE</span> <span class="floatLeft">Reviews</span><span class="floatRight" (click)="goToPage('reviewlist')">MORE</span>
<div class="clear"></div> <div class="clear"></div>
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
<div [ngClass]="checkFavStatus(similar.prodId)" (click)="changeFav(similar.prodId)"> <div [ngClass]="checkFavStatus(similar.prodId)" (click)="changeFav(similar.prodId)">
</div> </div>
</div> </div>
<h5>{{similar.prodName}}</h5> <h5>{{unEscape(similar.prodName)}}</h5>
<p>{{similar.price}}</p> <p>{{similar.price}}</p>
</li> </li>
</ion-slide> </ion-slide>
......
import { Component, OnInit } from "@angular/core"; import { Component, OnInit } from '@angular/core';
import { Location } from "@angular/common"; import { Location } from '@angular/common';
import { Router, ActivatedRoute } from "@angular/router"; import { Router, ActivatedRoute } from '@angular/router';
import { Products } from "./../../config/services/product"; import { Products } from './../../config/services/product';
import { Slides } from "./../../config/services/slides"; import { Slides } from './../../config/services/slides';
import { Order } from "./../../config/services/order"; import { Order } from './../../config/services/order';
import { CartsService } from "./../../config/cart.service"; import { CartsService } from './../../config/cart.service';
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 { SocialSharing } from "@ionic-native/social-sharing/ngx"; import { SocialSharing } from '@ionic-native/social-sharing/ngx';
import { map } from "rxjs/operators"; import { map } from 'rxjs/operators';
@Component({ @Component({
selector: "app-productdetail", selector: 'app-productdetail',
templateUrl: "./productdetail.page.html", templateUrl: './productdetail.page.html',
styleUrls: ["./productdetail.page.scss"] styleUrls: ['./productdetail.page.scss']
}) })
export class ProductdetailPage implements OnInit { export class ProductdetailPage implements OnInit {
disCart: boolean = true; disCart = true;
slide: Slides; slide: Slides;
product: Products; product: Products;
order: Order; order: Order;
...@@ -57,7 +57,7 @@ export class ProductdetailPage implements OnInit { ...@@ -57,7 +57,7 @@ export class ProductdetailPage implements OnInit {
params.subCate, params.subCate,
params.prodId params.prodId
); );
this.service.get("params").then(val => { this.service.get('params').then(val => {
this.data = val; this.data = val;
}); });
this.cartService.cartList(); this.cartService.cartList();
...@@ -74,6 +74,10 @@ export class ProductdetailPage implements OnInit { ...@@ -74,6 +74,10 @@ export class ProductdetailPage implements OnInit {
this.getProd(params); this.getProd(params);
} }
unEscape(text: string) {
return unescape(text);
}
getProd(params) { getProd(params) {
if (params) { if (params) {
let slideItem = []; let slideItem = [];
...@@ -134,9 +138,9 @@ export class ProductdetailPage implements OnInit { ...@@ -134,9 +138,9 @@ export class ProductdetailPage implements OnInit {
buyNow(product: any, type: number) { buyNow(product: any, type: number) {
this.cartService.buyNow(product).then(() => { this.cartService.buyNow(product).then(() => {
if (type === 1) { if (type === 1) {
this.router.navigateByUrl("cart"); this.router.navigateByUrl('cart');
} else { } else {
this.service.showToast("Added into cart", "top", "my-toast", 2000); this.service.showToast('Added into cart', 'top', 'my-toast', 2000);
} }
this.cartService.cartList(); this.cartService.cartList();
}); });
...@@ -148,32 +152,32 @@ export class ProductdetailPage implements OnInit { ...@@ -148,32 +152,32 @@ export class ProductdetailPage 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_active" : "fav"; return state > -1 ? 'fav_active' : 'fav';
} }
changeFav(index) { changeFav(index) {
this.prodService.changeFav(index, "yes"); this.prodService.changeFav(index, 'yes');
const state = this.prodService.fav.findIndex(x => x === index); const state = this.prodService.fav.findIndex(x => x === index);
// console.log(state); // console.log(state);
// 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);
} }
socialShare(prodName, category, subCate, price, image) { socialShare(prodName, category, subCate, price, image) {
const desc = category + ", " + subCate + ", " + price; const desc = category + ', ' + subCate + ', ' + price;
const content = { const content = {
message: desc, // not supported on some apps (Facebook, Instagram) message: desc, // not supported on some apps (Facebook, Instagram)
subject: prodName, // fi. for email subject: prodName, // fi. for email
files: image, files: image,
chooserTitle: "GetMi" chooserTitle: 'GetMi'
}; };
this.socialSharing.shareWithOptions(content); this.socialSharing.shareWithOptions(content);
} }
......
...@@ -3,22 +3,10 @@ ...@@ -3,22 +3,10 @@
<img src="../assets/Group17_2.png" /> <img src="../assets/Group17_2.png" />
</button> </button>
<div class="nav_title floatLeft"> <div class="nav_title floatLeft">
<input <input class="search_bar" placeholder="Search here.. eg:shirts, retailers etc..." (click)="clickSearch()" />
class="search_bar"
placeholder="Search here.. eg:shirts, retailers etc..."
(click)="clickSearch()"
/>
</div> </div>
<button <button class="nav_btn nav_search floatRight" *ngIf="!searchShow" (click)="clickSearch()"></button>
class="nav_btn nav_search floatRight" <button class="nav_btn nav_close floatRight" *ngIf="searchShow" (click)="searchClose()"></button>
*ngIf="!searchShow"
(click)="clickSearch()"
></button>
<button
class="nav_btn nav_close floatRight"
*ngIf="searchShow"
(click)="searchClose()"
></button>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<ion-content> <ion-content>
...@@ -26,11 +14,7 @@ ...@@ -26,11 +14,7 @@
<div class="product_taskbar"> <div class="product_taskbar">
<div class="filter floatLeft" (click)="istoggle()"></div> <div class="filter floatLeft" (click)="istoggle()"></div>
<div class="viewset floatRight"> <div class="viewset floatRight">
<div <div class="grid_view grid_act floatRight" (click)="gridToggle()" [class.line_view]="onGrid"></div>
class="grid_view grid_act floatRight"
(click)="gridToggle()"
[class.line_view]="onGrid"
></div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
...@@ -38,30 +22,18 @@ ...@@ -38,30 +22,18 @@
<div class="product_title" *ngIf="data"> <div class="product_title" *ngIf="data">
{{data.shopName}} {{data.shopName}}
</div> </div>
<ul <ul [class.grid_view]="onGrid" *ngIf="prodService.product && prodService.product.length > 0">
[class.grid_view]="onGrid"
*ngIf="prodService.product && prodService.product.length > 0"
>
<li *ngFor="let product of prodService.product; let i = index"> <li *ngFor="let product of prodService.product; let i = index">
<div class="product_image"> <div class="product_image">
<div class="load-back"> <div class="load-back">
<img <img [src]="product.image" onerror="this.src='../assets/[email protected]'" (click)="prodDetails(i)" />
[src]="product.image"
onerror="this.src='../assets/[email protected]'"
(click)="prodDetails(i)"
/>
</div> </div>
<div <div [ngClass]="checkFavStatus(product.prodId)" (click)="changeFav(product.prodId)"></div>
[ngClass]="checkFavStatus(product.prodId)"
(click)="changeFav(product.prodId)"
></div>
<div class="featured_badge" *ngIf="product.featured">Featured</div> <div class="featured_badge" *ngIf="product.featured">Featured</div>
</div> </div>
<h5 class="ellipse" (click)="prodDetails(i)" [innerHTML]="product.prodName"></h5> <h5 class="ellipse" (click)="prodDetails(i)" [innerHTML]="unEscape(product.prodName)"></h5>
<p (click)="prodDetails(i)"> <p (click)="prodDetails(i)">
A$ {{product.price}}<span class="offer" *ngIf="product.discount > 0" A$ {{product.price}}<span class="offer" *ngIf="product.discount > 0">-{{product.discount}}%</span>
>-{{product.discount}}%</span
>
</p> </p>
</li> </li>
</ul> </ul>
...@@ -110,47 +82,23 @@ ...@@ -110,47 +82,23 @@
<label for="styled-checkbox-2">Relevence</label> <label for="styled-checkbox-2">Relevence</label>
</li> --> </li> -->
<li> <li>
<input <input class="styled-checkbox" id="styled-checkbox-1" type="radio" value="newest" name="sort"
class="styled-checkbox" (click)="setValue($event.target.value)" />
id="styled-checkbox-1"
type="radio"
value="newest"
name="sort"
(click)="setValue($event.target.value)"
/>
<label for="styled-checkbox-1">Newest First</label> <label for="styled-checkbox-1">Newest First</label>
</li> </li>
<li> <li>
<input <input class="styled-checkbox" id="styled-checkbox-5" type="radio" value="a-z" name="sort"
class="styled-checkbox" (click)="setValue($event.target.value)" />
id="styled-checkbox-5"
type="radio"
value="a-z"
name="sort"
(click)="setValue($event.target.value)"
/>
<label for="styled-checkbox-5">Name A - Z</label> <label for="styled-checkbox-5">Name A - Z</label>
</li> </li>
<li> <li>
<input <input class="styled-checkbox" id="styled-checkbox-3" type="radio" value="low" name="sort"
class="styled-checkbox" (click)="setValue($event.target.value)" />
id="styled-checkbox-3"
type="radio"
value="low"
name="sort"
(click)="setValue($event.target.value)"
/>
<label for="styled-checkbox-3">Price Low - High</label> <label for="styled-checkbox-3">Price Low - High</label>
</li> </li>
<li> <li>
<input <input class="styled-checkbox" id="styled-checkbox-4" type="radio" value="high" name="sort"
class="styled-checkbox" (click)="setValue($event.target.value)" />
id="styled-checkbox-4"
type="radio"
value="high"
name="sort"
(click)="setValue($event.target.value)"
/>
<label for="styled-checkbox-4">Price High - Low</label> <label for="styled-checkbox-4">Price High - Low</label>
</li> </li>
...@@ -174,4 +122,4 @@ ...@@ -174,4 +122,4 @@
<div></div> <div></div>
</div> </div>
</div> </div>
</ion-content> </ion-content>
\ No newline at end of file
...@@ -63,7 +63,7 @@ export class ProductlistPage implements OnInit { ...@@ -63,7 +63,7 @@ export class ProductlistPage implements OnInit {
}); });
} }
ngOnInit() {} ngOnInit() { }
ionViewWillEnter() { ionViewWillEnter() {
console.log('logged'); console.log('logged');
...@@ -89,6 +89,10 @@ export class ProductlistPage implements OnInit { ...@@ -89,6 +89,10 @@ export class ProductlistPage implements OnInit {
window.history.back(); window.history.back();
} }
unEscape(text: string) {
return unescape(text);
}
gridToggle() { gridToggle() {
this.onGrid = !this.onGrid; this.onGrid = !this.onGrid;
} }
......
<div class="nav_header"> <div class="nav_header">
<button class="nav_btn nav_back floatLeft" (click)="closeModal()"></button> <button class="nav_btn nav_back floatLeft" (click)="closeModal()"></button>
<div class="nav_title floatLeft relative"> <div class="nav_title floatLeft relative">
<input <input class="search_bar" placeholder="Search here.. eg:shirts, retailers etc..." (click)="clickSearch()"
class="search_bar" (input)="searchFun($event.target.value)" #searchText />
placeholder="Search here.. eg:shirts, retailers etc..."
(click)="clickSearch()"
(input)="searchFun($event.target.value)"
#searchText
/>
</div> </div>
<button class="nav_btn nav_close floatRight" (click)="closeModal()"></button> <button class="nav_btn nav_close floatRight" (click)="closeModal()"></button>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="search_item_list"> <div class="search_item_list">
<ul *ngIf="searchService.searchList"> <ul *ngIf="searchService.searchList">
<li <li *ngFor="let search of searchService.searchList" (click)="viewPage(search)">{{unEscape(search.text)}}
*ngFor="let search of searchService.searchList"
(click)="viewPage(search)"
[innerHTML]="search.text">
</li> </li>
</ul> </ul>
</div> </div>
\ No newline at end of file
...@@ -19,7 +19,7 @@ export class SearchmodalPage implements OnInit { ...@@ -19,7 +19,7 @@ export class SearchmodalPage implements OnInit {
public service: ServiceService, public service: ServiceService,
private productsService: ProductsService, private productsService: ProductsService,
private router: Router private router: Router
) {} ) { }
ngOnInit() { ngOnInit() {
this.searchService.searchList = []; this.searchService.searchList = [];
...@@ -69,7 +69,11 @@ export class SearchmodalPage implements OnInit { ...@@ -69,7 +69,11 @@ export class SearchmodalPage implements OnInit {
this.searchShow = false; this.searchShow = false;
} }
unEscape(text: string) {
return unescape(text);
}
} }
...@@ -28,7 +28,7 @@ export class SignupPage implements OnInit { ...@@ -28,7 +28,7 @@ export class SignupPage implements OnInit {
currDate = new Date(); currDate = new Date();
mobnumPattern = '(\(+61\)|\+61|\(0[1-9]\)|0[1-9])?( ?-?[0-9]){6,10}'; mobnumPattern = '(\(+61\)|\+61|\(0[1-9]\)|0[1-9])?( ?-?[0-9]){6,10}';
minDate: any; minDate: any;
signup: Signup = { signup: Signup = {
emailId: '', emailId: '',
name: '', name: '',
password: '', password: '',
...@@ -48,8 +48,8 @@ export class SignupPage implements OnInit { ...@@ -48,8 +48,8 @@ export class SignupPage implements OnInit {
this.currDate.setFullYear(this.currDate.getFullYear() - 10); this.currDate.setFullYear(this.currDate.getFullYear() - 10);
console.log(this.currDate); console.log(this.currDate);
const month = this.currDate.getMonth() + 1 < 10 ? '0' + (this.currDate.getMonth() + 1) : '' + (this.currDate.getMonth() + 1), const month = this.currDate.getMonth() + 1 < 10 ? '0' + (this.currDate.getMonth() + 1) : '' + (this.currDate.getMonth() + 1),
day = this.currDate.getDate() < 10 ? '0' + this.currDate.getDate() : this.currDate.getDate(), day = this.currDate.getDate() < 10 ? '0' + this.currDate.getDate() : this.currDate.getDate(),
year = this.currDate.getFullYear(); year = this.currDate.getFullYear();
this.minDate = [year, month, day].join('-'); this.minDate = [year, month, day].join('-');
} }
...@@ -57,7 +57,7 @@ export class SignupPage implements OnInit { ...@@ -57,7 +57,7 @@ export class SignupPage implements OnInit {
} }
goToPage(path, data = null) { goToPage(path, data = null) {
this.router.navigateByUrl(path, { queryParams: data }); this.router.navigateByUrl(path, { replaceUrl: true, queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0; document.body.scrollTop = document.documentElement.scrollTop = 0;
} }
......
...@@ -21,7 +21,7 @@ export class VerificationPage implements OnInit { ...@@ -21,7 +21,7 @@ export class VerificationPage implements OnInit {
} }
goToPage(path, data = null) { goToPage(path, data = null) {
this.router.navigateByUrl(path, { queryParams: data }); this.router.navigateByUrl(path, { replaceUrl: true, queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0; document.body.scrollTop = document.documentElement.scrollTop = 0;
} }
......
...@@ -11,7 +11,7 @@ import { Address, AddressList } from './services/address'; ...@@ -11,7 +11,7 @@ import { Address, AddressList } from './services/address';
}) })
export class AddressService { export class AddressService {
addressList: AddressList[] = []; addressList: AddressList[] = [];
constructor(public afs: AngularFirestore) {} constructor(public afs: AngularFirestore) { }
public async addList(userId: string) { public async addList(userId: string) {
const This = this; const This = this;
...@@ -62,25 +62,35 @@ export class AddressService { ...@@ -62,25 +62,35 @@ export class AddressService {
}); });
} }
setDefaultAddress(addId: string, userId: string) {
changeAddress(data: Address, orderId) {
console.log(data);
this.afs this.afs
.collection('address', ref => ref.where('uid', '==', userId)) .collection('orders').doc(orderId).update({ deliveryAddress: data });
.get() }
.forEach(item => {
return item.docs.map(m => { async setDefaultAddress(addId: string, userId: string) {
return this.afs.doc(`address/${m.id}`).update({ defaultVal: 0 }); return await new Promise(resolve => {
});
});
setTimeout(() => {
console.log(addId);
this.afs this.afs
.collection('address') .collection('address', ref => ref.where('uid', '==', userId))
.doc(addId) .get()
.update({ defaultVal: 1 }) .forEach(item => {
.then(() => { return item.docs.map(m => {
console.log('Address updated Successfully'); return this.afs.doc(`address/${m.id}`).update({ defaultVal: 0 });
});
}); });
}, 1000); setTimeout(() => {
console.log(addId);
this.afs
.collection('address')
.doc(addId)
.update({ defaultVal: 1 })
.then(() => {
resolve(true);
console.log('Address updated Successfully');
});
}, 1000);
});
} }
deleteAddress(addId: string) { deleteAddress(addId: string) {
......
import { Injectable } from "@angular/core"; import { Injectable } from '@angular/core';
import { import {
AngularFirestore, AngularFirestore,
AngularFirestoreDocument, AngularFirestoreDocument,
AngularFirestoreCollection AngularFirestoreCollection
} from "@angular/fire/firestore"; } from '@angular/fire/firestore';
import { Centers, CenterData } from "./services/center"; import { Centers, CenterData } from './services/center';
import * as firebase from "firebase"; import * as firebase from 'firebase';
@Injectable({ @Injectable({
providedIn: "root" providedIn: 'root'
}) })
export class CenterService { export class CenterService {
centers: Centers[] = []; centers: Centers[] = [];
...@@ -22,8 +22,8 @@ export class CenterService { ...@@ -22,8 +22,8 @@ export class CenterService {
const This = this; const This = this;
const state = true; const state = true;
const orderRef: AngularFirestoreCollection<any> = this.afs.collection( const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"centers", 'centers',
ref => ref.where("featured", "==", state).where("status", "==", state) ref => ref.where('featured', '==', state).where('status', '==', state)
); );
orderRef.valueChanges().subscribe(value => { orderRef.valueChanges().subscribe(value => {
this.centers = []; this.centers = [];
...@@ -72,12 +72,12 @@ export class CenterService { ...@@ -72,12 +72,12 @@ export class CenterService {
greaterLon greaterLon
); );
const orderRef: AngularFirestoreCollection<any> = this.afs.collection( const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"centers", 'centers',
ref => ref =>
ref ref
.where("latLng", ">", lesserGeopoint) .where('latLng', '>', lesserGeopoint)
.where("latLng", "<", greaterGeopoint) .where('latLng', '<', greaterGeopoint)
.where("status", "==", state) .where('status', '==', state)
); );
orderRef.valueChanges().subscribe(value => { orderRef.valueChanges().subscribe(value => {
this.nearcenters = []; this.nearcenters = [];
......
...@@ -95,7 +95,7 @@ export class MyordersService { ...@@ -95,7 +95,7 @@ export class MyordersService {
public async orderList(custId) { public async orderList(custId) {
// console.log('called'); // console.log('called');
// console.log(custId); console.log(custId);
const This = this; const This = this;
this.orders = []; this.orders = [];
const orderRef: AngularFirestoreCollection<any> = this.afs.collection( const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
......
...@@ -36,6 +36,7 @@ export class OrdersService { ...@@ -36,6 +36,7 @@ export class OrdersService {
if (data) { if (data) {
data = JSON.parse(data); data = JSON.parse(data);
this.users = data; this.users = data;
console.log(this.users);
this.custId = data.uid; this.custId = data.uid;
// console.log(this.custId); // console.log(this.custId);
} else { } else {
...@@ -162,6 +163,7 @@ export class OrdersService { ...@@ -162,6 +163,7 @@ export class OrdersService {
// console.log(cartItem); // console.log(cartItem);
// console.log(products); // console.log(products);
const product = cartItem[0]; const product = cartItem[0];
this.custId = this.custId.trim();
const orderItem: Order = { const orderItem: Order = {
amount: 'A$ ' + otherCharge.totalAmt, amount: 'A$ ' + otherCharge.totalAmt,
customer: firebase.firestore().doc('/customer/' + this.custId), customer: firebase.firestore().doc('/customer/' + this.custId),
...@@ -184,7 +186,7 @@ export class OrdersService { ...@@ -184,7 +186,7 @@ export class OrdersService {
custId: this.custId, custId: this.custId,
riderId: 'qbTKza18mWVzYG9NLIbmjMbrYjG2', riderId: 'qbTKza18mWVzYG9NLIbmjMbrYjG2',
shopperId: product.shopperId, shopperId: product.shopperId,
custName: this.users.name, custName: 'Customer',
riderName: 'John', riderName: 'John',
shopperState: 0, shopperState: 0,
shopperName: '', shopperName: '',
......
...@@ -154,7 +154,7 @@ export class ProductsService { ...@@ -154,7 +154,7 @@ export class ProductsService {
brand: item.brand, brand: item.brand,
category: item.category, category: item.category,
shopperId: item.shopperId, shopperId: item.shopperId,
color: item.color, color: this.service.splitSep(item.color),
discount: item.discount, discount: item.discount,
featured: item.featured, featured: item.featured,
image: item.image, image: item.image,
......
...@@ -12,7 +12,7 @@ import { take } from 'rxjs/operators'; ...@@ -12,7 +12,7 @@ import { take } from 'rxjs/operators';
}) })
export class SearchService { export class SearchService {
searchList: Search[] = []; searchList: Search[] = [];
constructor(public afs: AngularFirestore) {} constructor(public afs: AngularFirestore) { }
public async search(inputText: string) { public async search(inputText: string) {
if (inputText === '') { if (inputText === '') {
...@@ -77,7 +77,7 @@ export class SearchService { ...@@ -77,7 +77,7 @@ export class SearchService {
// tslint:disable-next-line:max-line-length // tslint:disable-next-line:max-line-length
const feaRef: AngularFirestoreCollection<any> = this.afs.collection( const feaRef: AngularFirestoreCollection<any> = this.afs.collection(
'category', 'shopcategory',
ref => ref =>
ref ref
.where('status', '==', state) .where('status', '==', state)
......
import { Injectable } from "@angular/core"; import { Injectable } from '@angular/core';
import { AngularFireAuth } from "@angular/fire/auth"; import { AngularFireAuth } from '@angular/fire/auth';
import { import {
AngularFirestore, AngularFirestore,
AngularFirestoreDocument, AngularFirestoreDocument,
AngularFirestoreCollection AngularFirestoreCollection
} from "@angular/fire/firestore"; } from '@angular/fire/firestore';
import * as firebase from "firebase"; import * as firebase from 'firebase';
import { User } from "./services/user"; import { User } from './services/user';
@Injectable({ @Injectable({
providedIn: "root" providedIn: 'root'
}) })
// Gets User Details // Gets User Details
export class UserService { export class UserService {
users: User; users: User;
constructor(public afs: AngularFirestore, public afAuth: AngularFireAuth) {} constructor(public afs: AngularFirestore, public afAuth: AngularFireAuth) { }
public async getUserData(userId: string) { public async getUserData(userId: string) {
const This = this; const This = this;
...@@ -23,8 +23,8 @@ export class UserService { ...@@ -23,8 +23,8 @@ export class UserService {
// Get User Query // Get User Query
const userRef: AngularFirestoreCollection<any> = this.afs.collection( const userRef: AngularFirestoreCollection<any> = this.afs.collection(
"customers", 'customers',
ref => ref.where("uid", "==", userId).where("status", "==", state) ref => ref.where('uid', '==', userId).where('status', '==', state)
); );
userRef.valueChanges().subscribe(value => { userRef.valueChanges().subscribe(value => {
const res = value; const res = value;
...@@ -40,11 +40,11 @@ export class UserService { ...@@ -40,11 +40,11 @@ export class UserService {
phoneVerified: item.phoneVerified, phoneVerified: item.phoneVerified,
emailVerified: item.emailVerified, emailVerified: item.emailVerified,
loginType: 0, loginType: 0,
otp: "", otp: '',
currency: { currency: {
currId: "", currId: '',
currName: "", currName: '',
symbol: "" symbol: ''
} }
}; };
} }
......
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