Commit 1e6f206d by Adarsh K

getmi

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