Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
getme
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
amal
getme
Commits
f215b4c0
Commit
f215b4c0
authored
5 years ago
by
amalk
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into amal
parents
b8de975f
d8f289e1
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
169 additions
and
89 deletions
+169
-89
app.component.html
src/app/app.component.html
+3
-1
cart.module.ts
src/app/cart/cart.module.ts
+6
-0
cart.page.html
src/app/cart/cart.page.html
+6
-3
cart.page.ts
src/app/cart/cart.page.ts
+27
-1
myorder.page.html
src/app/myorder/myorder.page.html
+1
-1
myorder.page.ts
src/app/myorder/myorder.page.ts
+10
-1
nearby.page.html
src/app/nearby/nearby.page.html
+1
-1
nearby.page.ts
src/app/nearby/nearby.page.ts
+11
-1
orderplaced.page.html
src/app/orderplaced/orderplaced.page.html
+15
-14
orderplaced.page.ts
src/app/orderplaced/orderplaced.page.ts
+10
-3
productdetail.page.html
src/app/productdetail/productdetail.page.html
+2
-2
productdetail.page.ts
src/app/productdetail/productdetail.page.ts
+17
-17
auth.service.ts
src/config/auth.service.ts
+2
-1
cart.service.ts
src/config/cart.service.ts
+44
-37
myorder.service.ts
src/config/myorder.service.ts
+1
-0
order.service.ts
src/config/order.service.ts
+9
-6
myorder.ts
src/config/services/myorder.ts
+1
-0
order.ts
src/config/services/order.ts
+3
-0
No files found.
src/app/app.component.html
View file @
f215b4c0
...
@@ -3,16 +3,18 @@
...
@@ -3,16 +3,18 @@
<ion-menu>
<ion-menu>
<ion-content>
<ion-content>
<div
class=
"side_menu_wrapper"
>
<div
class=
"side_menu_wrapper"
>
<ion-menu-toggle>
<div
class=
"top_banner"
>
<div
class=
"top_banner"
>
<div
class=
"top_image"
>
<div
class=
"top_image"
>
</div>
</div>
<div
class=
"top_detail"
>
<div
class=
"top_detail"
>
<h4>
John Doe
</h4>
<h4>
John Doe
</h4>
<p>
john@dummymail.com
</p>
<p>
john@dummymail.com
</p>
</div>
</div>
<div
class=
"clear"
></div>
<div
class=
"clear"
></div>
</div>
</div>
</ion-menu-toggle>
<div
class=
"sidemenu_list"
>
<div
class=
"sidemenu_list"
>
<ul>
<ul>
<ion-menu-toggle>
<ion-menu-toggle>
...
...
This diff is collapsed.
Click to expand it.
src/app/cart/cart.module.ts
View file @
f215b4c0
...
@@ -2,6 +2,8 @@ import { NgModule } from '@angular/core';
...
@@ -2,6 +2,8 @@ import { NgModule } from '@angular/core';
import
{
CommonModule
}
from
'@angular/common'
;
import
{
CommonModule
}
from
'@angular/common'
;
import
{
FormsModule
}
from
'@angular/forms'
;
import
{
FormsModule
}
from
'@angular/forms'
;
import
{
Routes
,
RouterModule
}
from
'@angular/router'
;
import
{
Routes
,
RouterModule
}
from
'@angular/router'
;
import
{
AgmCoreModule
}
from
'@agm/core'
;
import
{
AgmDirectionModule
}
from
'agm-direction'
;
import
{
IonicModule
}
from
'@ionic/angular'
;
import
{
IonicModule
}
from
'@ionic/angular'
;
...
@@ -19,6 +21,10 @@ const routes: Routes = [
...
@@ -19,6 +21,10 @@ const routes: Routes = [
CommonModule
,
CommonModule
,
FormsModule
,
FormsModule
,
IonicModule
,
IonicModule
,
AgmDirectionModule
,
AgmCoreModule
.
forRoot
({
apiKey
:
'AIzaSyBn6hOlr6YHcZAmbptlsmbhvH5iQllWflE'
}),
RouterModule
.
forChild
(
routes
)
RouterModule
.
forChild
(
routes
)
],
],
declarations
:
[
CartPage
]
declarations
:
[
CartPage
]
...
...
This diff is collapsed.
Click to expand it.
src/app/cart/cart.page.html
View file @
f215b4c0
...
@@ -134,7 +134,7 @@
...
@@ -134,7 +134,7 @@
<div class="card_div" [hidden]="gateway !=3">
<div class="card_div" [hidden]="gateway !=3">
<input class="card_no borderNone widthFull" placeholder="PafyK ID">
<input class="card_no borderNone widthFull" placeholder="PafyK ID">
</div> -->
</div> -->
<div
class=
"delivery_time"
>
<
!-- <
div class="delivery_time">
<ul>
<ul>
<li>
<li>
Delivery 10 Mnt<br>
Delivery 10 Mnt<br>
...
@@ -145,10 +145,12 @@
...
@@ -145,10 +145,12 @@
<strong>FREE</strong>
<strong>FREE</strong>
</li>
</li>
</ul>
</ul>
</div>
</div>
-->
<hr>
<hr>
<div
class=
"coupon_code"
>
<div
class=
"coupon_code"
>
<input
class=
""
placeholder=
"COUPON CODE"
><button
class=
"add_btn"
>
ADD
</button>
<input
class=
""
placeholder=
"COUPON CODE"
#
promo
><button
class=
"add_btn"
(
click
)="
promoApply
(
promo
.
value
)"
>
ADD
</button>
<br/>
<h6>
GET50
</h6>
<span
*
ngIf=
"discountApplied"
style=
"color: red"
>
Promocode applied successfully
</span>
</div>
</div>
<br/>
<br/>
...
@@ -220,3 +222,4 @@
...
@@ -220,3 +222,4 @@
<div></div>
<div></div>
</div>
</div>
</div>
</div>
This diff is collapsed.
Click to expand it.
src/app/cart/cart.page.ts
View file @
f215b4c0
...
@@ -128,7 +128,15 @@ export class CartPage implements OnInit {
...
@@ -128,7 +128,15 @@ export class CartPage implements OnInit {
},
500
);
},
500
);
console
.
log
(
index
);
console
.
log
(
index
);
if
(
index
===
2
)
{
if
(
index
===
2
)
{
const
state
=
this
.
orderService
.
checkOut
(
this
.
cartService
.
carts
).
then
((
data
)
=>
{
const
otherCharges
=
{
deliveryCharge
:
this
.
deliveryCharge
,
taxAmount
:
this
.
taxAmount
,
discount
:
this
.
discount
,
discountApplied
:
this
.
discountApplied
,
totalAmt
:
this
.
totalAmt
,
custAddress
:
this
.
custAddress
};
const
state
=
this
.
orderService
.
checkOut
(
this
.
cartService
.
carts
,
otherCharges
).
then
((
data
)
=>
{
console
.
log
(
'ready for slide'
);
console
.
log
(
'ready for slide'
);
this
.
slides
.
slideNext
();
this
.
slides
.
slideNext
();
});
});
...
@@ -175,4 +183,22 @@ export class CartPage implements OnInit {
...
@@ -175,4 +183,22 @@ export class CartPage implements OnInit {
return
actualTotal
;
return
actualTotal
;
}
}
promoApply
(
code
)
{
console
.
log
(
code
);
this
.
cartService
.
checkPromo
(
code
).
subscribe
((
value
)
=>
{
if
(
value
.
length
>
0
)
{
const
promo
=
value
[
0
];
this
.
discountApplied
=
true
;
if
(
value
[
0
].
type
===
1
)
{
const
rate
=
value
[
0
].
amount
;
const
upto
=
value
[
0
].
amount
;
const
percentage
=
(
this
.
cartService
.
cartTotal
*
rate
)
/
100
;
this
.
discount
=
percentage
>
upto
?
upto
:
percentage
;
}
else
{
this
.
discount
=
value
[
0
].
amount
;
}
}
});
}
}
}
This diff is collapsed.
Click to expand it.
src/app/myorder/myorder.page.html
View file @
f215b4c0
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<button
class=
"order_track floatRight"
*
ngIf=
"order.orderStatus >= 3 && order.orderStatus < 7"
(
click
)="
orderDetails
(
i
)"
>
Track Order
</button>
<button
class=
"order_track floatRight"
*
ngIf=
"order.orderStatus >= 3 && order.orderStatus < 7"
(
click
)="
orderDetails
(
i
)"
>
Track Order
</button>
<div
class=
"clear"
></div>
<div
class=
"clear"
></div>
</div>
</div>
<div
*
ngFor=
"let product of order.product"
>
<div
*
ngFor=
"let product of order.product"
(
click
)="
viewOrder
(
order
)"
>
<div
class=
"order_image"
><img
[
src
]="
product
.
image
"
onerror=
""
/></div>
<div
class=
"order_image"
><img
[
src
]="
product
.
image
"
onerror=
""
/></div>
<div
class=
"order_detail"
>
<div
class=
"order_detail"
>
<h5
class=
"floatLeft"
>
{{product.prodName}}
</h5>
<h5
class=
"floatLeft"
>
{{product.prodName}}
</h5>
...
...
This diff is collapsed.
Click to expand it.
src/app/myorder/myorder.page.ts
View file @
f215b4c0
...
@@ -4,6 +4,7 @@ import { Router, ActivatedRoute } from '@angular/router';
...
@@ -4,6 +4,7 @@ import { Router, ActivatedRoute } from '@angular/router';
import
{
MyordersService
}
from
'./../../config/myorder.service'
;
import
{
MyordersService
}
from
'./../../config/myorder.service'
;
import
{
ModalController
}
from
'@ionic/angular'
;
import
{
ModalController
}
from
'@ionic/angular'
;
import
{
DeliverypopPage
}
from
'../deliverypop/deliverypop.page'
;
import
{
DeliverypopPage
}
from
'../deliverypop/deliverypop.page'
;
import
{
ServiceService
}
from
'./../../config/service.service'
;
@
Component
({
@
Component
({
selector
:
'app-myorder'
,
selector
:
'app-myorder'
,
...
@@ -18,7 +19,8 @@ export class MyorderPage implements OnInit {
...
@@ -18,7 +19,8 @@ export class MyorderPage implements OnInit {
private
route
:
ActivatedRoute
,
private
route
:
ActivatedRoute
,
private
location
:
Location
,
private
location
:
Location
,
public
myorder
:
MyordersService
,
public
myorder
:
MyordersService
,
public
modalController
:
ModalController
public
modalController
:
ModalController
,
public
service
:
ServiceService
)
{
}
)
{
}
ngOnInit
()
{
ngOnInit
()
{
...
@@ -59,6 +61,13 @@ export class MyorderPage implements OnInit {
...
@@ -59,6 +61,13 @@ export class MyorderPage implements OnInit {
}
}
}
}
viewOrder
(
data
)
{
console
.
log
(
data
);
this
.
service
.
set
(
'order'
,
data
);
this
.
router
.
navigateByUrl
(
'orderplaced'
,
{
queryParams
:
data
});
document
.
body
.
scrollTop
=
document
.
documentElement
.
scrollTop
=
0
;
}
getStatus
(
status
:
number
)
{
getStatus
(
status
:
number
)
{
switch
(
status
)
{
switch
(
status
)
{
case
1
:
case
1
:
...
...
This diff is collapsed.
Click to expand it.
src/app/nearby/nearby.page.html
View file @
f215b4c0
<div
class=
"nav_header"
>
<div
class=
"nav_header"
>
<button
class=
"nav_btn nav_back floatLeft"
(
click
)="
goBack
()"
>
<button
class=
"nav_btn nav_back floatLeft"
(
click
)="
goBack
()"
*
ngIf=
"type === 0"
>
<img
src=
"../assets/Group17_2.png"
>
<img
src=
"../assets/Group17_2.png"
>
</button>
</button>
<div
class=
"nav_title floatLeft"
>
<div
class=
"nav_title floatLeft"
>
...
...
This diff is collapsed.
Click to expand it.
src/app/nearby/nearby.page.ts
View file @
f215b4c0
...
@@ -7,7 +7,7 @@ import { AddressService } from './../../config/address.service';
...
@@ -7,7 +7,7 @@ import { AddressService } from './../../config/address.service';
import
{
ServiceService
}
from
'./../../config/service.service'
;
import
{
ServiceService
}
from
'./../../config/service.service'
;
import
{
NgForm
}
from
'@angular/forms'
;
import
{
NgForm
}
from
'@angular/forms'
;
import
*
as
firebase
from
'firebase'
;
import
*
as
firebase
from
'firebase'
;
import
{
google
}
from
'@agm/core/services/google-maps-types'
;
/* import { google } from '@agm/core/services/google-maps-types'; */
@
Component
({
@
Component
({
selector
:
'app-nearby'
,
selector
:
'app-nearby'
,
...
@@ -25,6 +25,7 @@ export class NearbyPage implements OnInit {
...
@@ -25,6 +25,7 @@ export class NearbyPage implements OnInit {
addressData
=
new
Address
(
''
,
''
,
''
,
''
,
true
,
''
,
0
,
''
);
addressData
=
new
Address
(
''
,
''
,
''
,
''
,
true
,
''
,
0
,
''
);
successState
:
boolean
;
successState
:
boolean
;
uid
:
string
;
uid
:
string
;
type
:
any
;
public
searchElementRef
:
ElementRef
;
public
searchElementRef
:
ElementRef
;
constructor
(
constructor
(
...
@@ -37,12 +38,17 @@ export class NearbyPage implements OnInit {
...
@@ -37,12 +38,17 @@ export class NearbyPage implements OnInit {
public
service
:
ServiceService
public
service
:
ServiceService
)
{
)
{
this
.
successState
=
false
;
this
.
successState
=
false
;
this
.
type
=
0
;
const
users
=
this
.
service
.
get
(
'user'
).
then
((
data
)
=>
{
const
users
=
this
.
service
.
get
(
'user'
).
then
((
data
)
=>
{
if
(
data
)
{
if
(
data
)
{
data
=
JSON
.
parse
(
data
);
data
=
JSON
.
parse
(
data
);
this
.
uid
=
data
.
uid
;
this
.
uid
=
data
.
uid
;
}
}
});
});
this
.
service
.
get
(
'type'
).
then
((
data
)
=>
{
this
.
type
=
data
;
});
}
}
ngOnInit
()
{
ngOnInit
()
{
...
@@ -118,6 +124,10 @@ export class NearbyPage implements OnInit {
...
@@ -118,6 +124,10 @@ export class NearbyPage implements OnInit {
this
.
successState
=
true
;
this
.
successState
=
true
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
successState
=
false
;
this
.
successState
=
false
;
if
(
this
.
type
===
1
)
{
this
.
service
.
set
(
'type'
,
0
);
this
.
router
.
navigateByUrl
(
'home'
,
{
queryParams
:
null
});
}
},
3000
);
},
3000
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/app/orderplaced/orderplaced.page.html
View file @
f215b4c0
<ion-content>
<ion-content>
<div
class=
"cart_wrapper"
>
<div
class=
"cart_wrapper"
*
ngIf=
"data"
>
<div
class=
"cart_head"
>
<div
class=
"cart_head"
>
<div
class=
"nav_header"
>
<div
class=
"nav_header"
>
<button
class=
"nav_btn nav_back_white floatLeft"
(
click
)="
goBack
()"
>
<button
class=
"nav_btn nav_back_white floatLeft"
(
click
)="
goBack
()"
>
...
@@ -14,16 +14,16 @@
...
@@ -14,16 +14,16 @@
</div>
</div>
<img
src=
"../assets/white_tick.png"
>
<img
src=
"../assets/white_tick.png"
>
<h4>
ORDER IS PLACED
</h4>
<h4>
ORDER IS PLACED
</h4>
<p>
June 26th 2019, 03:00 PM
</p>
<p>
{{ data.bookDate.seconds * 1000 | date:'MMMM dd, y' }}
</p>
</div>
</div>
<div
class=
"order_status"
>
<div
class=
"order_status"
>
<div
class=
"clear"
></div>
<div
class=
"clear"
></div>
<div
class=
"status_div go_green"
>
<div
class=
"status_div go_green"
>
<h4>
Order Placed
</h4>
<h4>
Order Placed
</h4>
<h6>
June 26th 2019, 03:00PM
</h6>
<h6>
{{ data.bookDate.seconds * 1000 | date:'MMMM dd, y' }}
</h6>
</div>
</div>
<div
class=
"status_gap go_green"
>
<
!-- <
div class="status_gap go_green">
</div>
</div>
<div class="status_div go_green">
<div class="status_div go_green">
<h4>Retailer Accepted</h4>
<h4>Retailer Accepted</h4>
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
</div>
</div>
<div class="status_div">
<div class="status_div">
<h4>Your product is delivered</h4>
<h4>Your product is delivered</h4>
</div>
</div>
-->
</div>
</div>
<div
class=
"nearby_shop_list"
>
<div
class=
"nearby_shop_list"
>
<ul>
<ul>
...
@@ -65,8 +65,8 @@
...
@@ -65,8 +65,8 @@
</div>
</div>
<div
class=
"nearby_detail"
>
<div
class=
"nearby_detail"
>
<h5>
<h5>
<span
class=
"floatLeft"
>
Carnival Life
</span>
<span
class=
"floatLeft"
>
{{data.shopperName}}
</span>
<span
class=
"floatRight"
>
4
<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>
...
@@ -77,20 +77,20 @@
...
@@ -77,20 +77,20 @@
</li>
</li>
</ul>
</ul>
</div>
</div>
<div
class=
"product_detail"
>
<div
class=
"product_detail"
*
ngFor=
"let product of data.product"
>
<h6>
Green, Small
</h6>
<h6>
{{product.color}}, {{product.size}}
</h6>
<h5>
Quantity :
<span>
3
</span></h5>
<h5>
Quantity :
<span>
{{product.qty}}
</span></h5>
<h5>
Amount :
<strong>
A
U$99.00
</strong><span
class=
"afterpay"
>
After Pay
</span></h5>
<h5>
Amount :
<strong>
A
$ {{product.price}}
</strong><span
class=
"afterpay"
>
COD
</span></h5>
<h5>
Delivery time :
<span>
Delivery in 1 hour
</span></h5>
<h5>
Delivery time :
<span>
Delivery in 1 hour
</span></h5>
<h4>
DELIVERY
</h4>
<h4>
DELIVERY
</h4>
<h5>
<h5>
Shamjith KS
<br>
+00 0000 888 888
<br>
Carnival InfoparkInfopark Kochi
<br>
682030, Kerala, India
{{deliveryAddress}}
</h5>
</h5>
<button
class=
"cancel_btn"
(
click
)="
goToPage
('
ordercancelled
')"
>
CANCEL THIS ORDER
</button>
<button
class=
"cancel_btn"
(
click
)="
goToPage
('
ordercancelled
')"
>
CANCEL THIS ORDER
</button>
<hr>
<hr>
</div>
</div>
<div
class=
"related_product_slider"
>
<
!-- <
div class="related_product_slider">
<h5>
<h5>
<span class="floatLeft">Related Products</span><span class="floatRight">MORE</span>
<span class="floatLeft">Related Products</span><span class="floatRight">MORE</span>
<div class="clear"></div>
<div class="clear"></div>
...
@@ -144,6 +144,6 @@
...
@@ -144,6 +144,6 @@
</ion-slide>
</ion-slide>
</ion-slides>
</ion-slides>
</ul>
</ul>
</div>
</div>
-->
</div>
</div>
</ion-content>
</ion-content>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/app/orderplaced/orderplaced.page.ts
View file @
f215b4c0
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
{
ServiceService
}
from
'./../../config/service.service'
;
@
Component
({
@
Component
({
selector
:
'app-orderplaced'
,
selector
:
'app-orderplaced'
,
...
@@ -8,12 +9,18 @@ import { Router, ActivatedRoute } from '@angular/router';
...
@@ -8,12 +9,18 @@ import { Router, ActivatedRoute } from '@angular/router';
styleUrls
:
[
'./orderplaced.page.scss'
],
styleUrls
:
[
'./orderplaced.page.scss'
],
})
})
export
class
OrderplacedPage
implements
OnInit
{
export
class
OrderplacedPage
implements
OnInit
{
data
:
any
;
constructor
(
constructor
(
private
router
:
Router
,
private
router
:
Router
,
private
route
:
ActivatedRoute
,
private
route
:
ActivatedRoute
,
private
location
:
Location
private
location
:
Location
,
)
{
}
private
service
:
ServiceService
)
{
this
.
service
.
get
(
'order'
).
then
(
val
=>
{
this
.
data
=
val
;
});
}
ngOnInit
()
{
ngOnInit
()
{
}
}
...
...
This diff is collapsed.
Click to expand it.
src/app/productdetail/productdetail.page.html
View file @
f215b4c0
...
@@ -79,7 +79,7 @@
...
@@ -79,7 +79,7 @@
</ion-slides>
</ion-slides>
</ul>
</ul>
</div>
</div>
<h5>
Color
</h5>
<
!-- <
h5>Color</h5>
<div class="color_div">
<div class="color_div">
<ul>
<ul>
<ion-slides pager="false" [options]="slideOpts">
<ion-slides pager="false" [options]="slideOpts">
...
@@ -135,7 +135,7 @@
...
@@ -135,7 +135,7 @@
</ion-slide>
</ion-slide>
</ion-slides>
</ion-slides>
</ul>
</ul>
</div>
</div>
-->
<h5>
Description
</h5>
<h5>
Description
</h5>
<p>
{{product.prodDesc}}
<p>
{{product.prodDesc}}
</p>
</p>
...
...
This diff is collapsed.
Click to expand it.
src/app/productdetail/productdetail.page.ts
View file @
f215b4c0
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
{
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
{
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
{
product
:
Products
;
product
:
Products
;
...
@@ -47,7 +47,7 @@ export class ProductdetailPage implements OnInit {
...
@@ -47,7 +47,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
();
...
@@ -112,7 +112,7 @@ export class ProductdetailPage implements OnInit {
...
@@ -112,7 +112,7 @@ 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
{
// alert('Product added to cart');
// alert('Product added to cart');
}
}
...
@@ -126,7 +126,7 @@ export class ProductdetailPage implements OnInit {
...
@@ -126,7 +126,7 @@ 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_fill"
:
"fav_icon"
;
return
state
>
-
1
?
'fav_fill'
:
'fav_icon'
;
}
}
changeFav
(
index
)
{
changeFav
(
index
)
{
...
@@ -135,10 +135,10 @@ export class ProductdetailPage implements OnInit {
...
@@ -135,10 +135,10 @@ export class ProductdetailPage implements OnInit {
console
.
log
(
this
.
prodService
.
fav
);
console
.
log
(
this
.
prodService
.
fav
);
if
(
state
>
-
1
)
{
if
(
state
>
-
1
)
{
this
.
prodService
.
fav
.
splice
(
state
,
1
);
this
.
prodService
.
fav
.
splice
(
state
,
1
);
this
.
prodService
.
changeFav
(
index
,
"yes"
);
this
.
prodService
.
changeFav
(
index
,
'yes'
);
}
else
{
}
else
{
this
.
prodService
.
fav
.
push
(
index
);
this
.
prodService
.
fav
.
push
(
index
);
this
.
prodService
.
changeFav
(
index
,
"no"
);
this
.
prodService
.
changeFav
(
index
,
'no'
);
}
}
return
;
return
;
console
.
log
(
this
.
prodService
.
fav
);
console
.
log
(
this
.
prodService
.
fav
);
...
...
This diff is collapsed.
Click to expand it.
src/config/auth.service.ts
View file @
f215b4c0
...
@@ -63,7 +63,8 @@ export class AuthService {
...
@@ -63,7 +63,8 @@ export class AuthService {
custRef
.
valueChanges
().
pipe
(
take
(
1
)).
subscribe
((
value
:
User
[])
=>
{
custRef
.
valueChanges
().
pipe
(
take
(
1
)).
subscribe
((
value
:
User
[])
=>
{
if
(
value
.
length
>
0
)
{
if
(
value
.
length
>
0
)
{
this
.
afs
.
collection
(
'customers'
).
doc
(
this
.
userData
.
uid
).
update
({
otp
:
''
});
this
.
afs
.
collection
(
'customers'
).
doc
(
this
.
userData
.
uid
).
update
({
otp
:
''
});
this
.
router
.
navigateByUrl
(
'addaddresss'
);
this
.
service
.
set
(
'type'
,
1
);
this
.
router
.
navigateByUrl
(
'nearby'
);
}
else
{
}
else
{
window
.
alert
(
'Please input valid OTP'
);
window
.
alert
(
'Please input valid OTP'
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/config/cart.service.ts
View file @
f215b4c0
import
{
Injectable
}
from
"@angular/core"
;
import
{
Injectable
}
from
'@angular/core'
;
import
{
import
{
AngularFirestore
,
AngularFirestoreDocument
,
AngularFirestoreCollection
}
from
'@angular/fire/firestore'
;
AngularFirestore
,
import
{
Router
,
ActivatedRoute
}
from
'@angular/router'
;
AngularFirestoreDocument
,
import
{
Products
}
from
'./services/product'
;
AngularFirestoreCollection
import
{
Cart
,
CartItem
}
from
'./services/cart'
;
}
from
"@angular/fire/firestore"
;
import
{
ServiceService
}
from
'./service.service'
;
import
{
Router
,
ActivatedRoute
}
from
"@angular/router"
;
import
*
as
firebase
from
'firebase'
;
import
{
Products
}
from
"./services/product"
;
import
{
take
}
from
'rxjs/operators'
;
import
{
Cart
,
CartItem
}
from
"./services/cart"
;
import
{
User
}
from
'./services/user'
;
import
{
ServiceService
}
from
"./service.service"
;
import
{
from
}
from
'rxjs'
;
import
*
as
firebase
from
"firebase"
;
import
{
take
}
from
"rxjs/operators"
;
import
{
User
}
from
"./services/user"
;
import
{
from
}
from
"rxjs"
;
@
Injectable
({
@
Injectable
({
providedIn
:
"root"
providedIn
:
'root'
})
})
export
class
CartsService
{
export
class
CartsService
{
size
:
string
;
size
:
string
;
...
@@ -31,15 +27,13 @@ export class CartsService {
...
@@ -31,15 +27,13 @@ export class CartsService {
public
router
:
Router
,
public
router
:
Router
,
public
service
:
ServiceService
public
service
:
ServiceService
)
{
)
{
this
.
custId
=
""
;
this
.
custId
=
''
;
this
.
carts
=
[];
this
.
carts
=
[];
const
users
=
this
.
service
.
get
(
"user"
).
then
(
data
=>
{
const
users
=
this
.
service
.
get
(
'user'
).
then
(
data
=>
{
if
(
data
)
{
if
(
data
)
{
data
=
JSON
.
parse
(
data
);
data
=
JSON
.
parse
(
data
);
this
.
custId
=
data
.
uid
;
this
.
custId
=
data
.
uid
;
console
.
log
(
this
.
custId
);
console
.
log
(
this
.
custId
);
}
else
{
this
.
custId
=
"WwHnLICVY2dvZGUHuKqasiTB91a2"
;
}
}
});
});
}
}
...
@@ -48,20 +42,20 @@ export class CartsService {
...
@@ -48,20 +42,20 @@ export class CartsService {
this
.
prodId
=
product
.
prodId
;
this
.
prodId
=
product
.
prodId
;
const
prodRef
=
firebase
const
prodRef
=
firebase
.
firestore
()
.
firestore
()
.
collection
(
"products"
)
.
collection
(
'products'
)
.
doc
(
this
.
prodId
);
.
doc
(
this
.
prodId
);
this
.
size
=
this
.
size
===
undefined
?
product
.
size
[
0
]
:
this
.
size
;
this
.
size
=
this
.
size
===
undefined
?
product
.
size
[
0
]
:
this
.
size
;
this
.
color
=
this
.
color
===
undefined
?
product
.
color
[
0
]
:
this
.
color
;
this
.
color
=
this
.
color
===
undefined
?
product
.
color
[
0
]
:
this
.
color
;
const
cartRef
:
AngularFirestoreCollection
<
any
>
=
this
.
afs
.
collection
(
const
cartRef
:
AngularFirestoreCollection
<
any
>
=
this
.
afs
.
collection
(
"carts"
,
'carts'
,
ref
=>
ref
=>
ref
ref
.
where
(
"size"
,
"=="
,
this
.
size
)
.
where
(
'size'
,
'=='
,
this
.
size
)
.
where
(
"color"
,
"=="
,
this
.
color
)
.
where
(
'color'
,
'=='
,
this
.
color
)
.
where
(
"custId"
,
"=="
,
this
.
custId
)
.
where
(
'custId'
,
'=='
,
this
.
custId
)
.
where
(
"product"
,
"=="
,
prodRef
)
.
where
(
'product'
,
'=='
,
prodRef
)
);
);
cartRef
cartRef
.
valueChanges
()
.
valueChanges
()
...
@@ -71,7 +65,7 @@ export class CartsService {
...
@@ -71,7 +65,7 @@ export class CartsService {
if
(
value
.
length
===
0
)
{
if
(
value
.
length
===
0
)
{
product
.
image
=
product
.
image
=
product
.
image
===
undefined
product
.
image
===
undefined
?
"../assets/model1@3x.jpg"
?
'../assets/model1@3x.jpg'
:
product
.
image
;
:
product
.
image
;
const
cart
:
Cart
=
{
const
cart
:
Cart
=
{
color
:
this
.
color
,
color
:
this
.
color
,
...
@@ -88,21 +82,21 @@ export class CartsService {
...
@@ -88,21 +82,21 @@ export class CartsService {
};
};
console
.
log
(
cart
);
console
.
log
(
cart
);
this
.
afs
this
.
afs
.
collection
(
"carts"
)
.
collection
(
'carts'
)
.
add
(
cart
)
.
add
(
cart
)
.
then
(
docRef
=>
{
.
then
(
docRef
=>
{
const
neworderId
=
docRef
.
id
;
const
neworderId
=
docRef
.
id
;
this
.
afs
this
.
afs
.
collection
(
"carts"
)
.
collection
(
'carts'
)
.
doc
(
neworderId
)
.
doc
(
neworderId
)
.
update
({
cartId
:
docRef
.
id
})
.
update
({
cartId
:
docRef
.
id
})
.
then
(()
=>
{
.
then
(()
=>
{
console
.
log
(
"Booking Successfully"
);
console
.
log
(
'Booking Successfully'
);
document
.
body
.
scrollTop
=
document
.
documentElement
.
scrollTop
=
0
;
document
.
body
.
scrollTop
=
document
.
documentElement
.
scrollTop
=
0
;
});
});
})
})
.
catch
(
error
=>
{
.
catch
(
error
=>
{
console
.
error
(
"Error adding document: "
,
error
);
console
.
error
(
'Error adding document: '
,
error
);
});
});
}
else
{
}
else
{
console
.
log
(
value
);
console
.
log
(
value
);
...
@@ -111,11 +105,11 @@ export class CartsService {
...
@@ -111,11 +105,11 @@ export class CartsService {
// tslint:disable-next-line:radix
// tslint:disable-next-line:radix
const
qty
=
parseInt
(
value
[
0
].
qty
)
+
1
;
const
qty
=
parseInt
(
value
[
0
].
qty
)
+
1
;
this
.
afs
this
.
afs
.
collection
(
"carts"
)
.
collection
(
'carts'
)
.
doc
(
cartId
)
.
doc
(
cartId
)
.
update
({
qty
:
`
${
qty
}
`
})
.
update
({
qty
:
`
${
qty
}
`
})
.
then
(()
=>
{
.
then
(()
=>
{
console
.
log
(
"Booking Successfully"
);
console
.
log
(
'Booking Successfully'
);
document
.
body
.
scrollTop
=
document
.
documentElement
.
scrollTop
=
0
;
document
.
body
.
scrollTop
=
document
.
documentElement
.
scrollTop
=
0
;
});
});
}
}
...
@@ -124,8 +118,8 @@ export class CartsService {
...
@@ -124,8 +118,8 @@ export class CartsService {
public
async
cartList
()
{
public
async
cartList
()
{
const
cartRef
:
AngularFirestoreCollection
<
any
>
=
this
.
afs
.
collection
(
const
cartRef
:
AngularFirestoreCollection
<
any
>
=
this
.
afs
.
collection
(
"carts"
,
'carts'
,
ref
=>
ref
.
where
(
"custId"
,
"=="
,
this
.
custId
)
ref
=>
ref
.
where
(
'custId'
,
'=='
,
this
.
custId
)
);
);
cartRef
.
valueChanges
().
subscribe
(
value
=>
{
cartRef
.
valueChanges
().
subscribe
(
value
=>
{
this
.
carts
=
[];
this
.
carts
=
[];
...
@@ -183,7 +177,7 @@ export class CartsService {
...
@@ -183,7 +177,7 @@ export class CartsService {
this
.
carts
[
index
].
qty
=
qty
;
this
.
carts
[
index
].
qty
=
qty
;
console
.
log
(
this
.
carts
[
index
].
qty
);
console
.
log
(
this
.
carts
[
index
].
qty
);
this
.
afs
this
.
afs
.
collection
(
"carts"
)
.
collection
(
'carts'
)
.
doc
(
this
.
carts
[
index
].
cartId
)
.
doc
(
this
.
carts
[
index
].
cartId
)
.
update
({
.
update
({
qty
:
this
.
carts
[
index
].
qty
qty
:
this
.
carts
[
index
].
qty
...
@@ -195,7 +189,7 @@ export class CartsService {
...
@@ -195,7 +189,7 @@ export class CartsService {
this
.
cartTotal
=
0
;
this
.
cartTotal
=
0
;
this
.
carts
[
index
].
qty
=
qty
;
this
.
carts
[
index
].
qty
=
qty
;
this
.
afs
this
.
afs
.
collection
(
"carts"
)
.
collection
(
'carts'
)
.
doc
(
this
.
carts
[
index
].
cartId
)
.
doc
(
this
.
carts
[
index
].
cartId
)
.
update
({
.
update
({
qty
:
this
.
carts
[
index
].
qty
qty
:
this
.
carts
[
index
].
qty
...
@@ -204,8 +198,21 @@ export class CartsService {
...
@@ -204,8 +198,21 @@ export class CartsService {
removeItem
(
index
)
{
removeItem
(
index
)
{
this
.
afs
this
.
afs
.
collection
(
"carts"
)
.
collection
(
'carts'
)
.
doc
(
this
.
carts
[
index
].
cartId
)
.
doc
(
this
.
carts
[
index
].
cartId
)
.
delete
();
.
delete
();
}
}
checkPromo
(
promoCode
:
string
)
{
console
.
log
(
promoCode
);
const
state
=
true
;
const
promoRef
:
AngularFirestoreCollection
<
any
>
=
this
.
afs
.
collection
(
'promocode'
,
ref
=>
ref
.
where
(
'promoCode'
,
'=='
,
promoCode
)
.
where
(
'status'
,
'=='
,
state
));
return
promoRef
.
valueChanges
();
}
}
}
This diff is collapsed.
Click to expand it.
src/config/myorder.service.ts
View file @
f215b4c0
...
@@ -102,6 +102,7 @@ export class MyordersService {
...
@@ -102,6 +102,7 @@ export class MyordersService {
bookDate
:
item
.
bookDate
,
bookDate
:
item
.
bookDate
,
deliveryLocation
:
item
.
deliveryLocation
,
deliveryLocation
:
item
.
deliveryLocation
,
pickupLocation
:
item
.
pickupLocation
,
pickupLocation
:
item
.
pickupLocation
,
deliveryAddress
:
item
.
deliveryAddress
,
riderName
:
'John'
,
riderName
:
'John'
,
orderId
:
item
.
orderId
,
orderId
:
item
.
orderId
,
orderCode
:
item
.
orderCode
,
orderCode
:
item
.
orderCode
,
...
...
This diff is collapsed.
Click to expand it.
src/config/order.service.ts
View file @
f215b4c0
...
@@ -104,7 +104,7 @@ export class OrdersService {
...
@@ -104,7 +104,7 @@ export class OrdersService {
}*/
}*/
public
async
checkOut
(
cart
:
CartItem
[])
{
public
async
checkOut
(
cart
:
CartItem
[]
,
otherCharge
)
{
console
.
log
(
cart
);
console
.
log
(
cart
);
console
.
log
(
this
.
users
);
console
.
log
(
this
.
users
);
const
cartGroup
=
[];
const
cartGroup
=
[];
...
@@ -112,7 +112,7 @@ export class OrdersService {
...
@@ -112,7 +112,7 @@ export class OrdersService {
const
distinctShops
=
[];
const
distinctShops
=
[];
const
map
=
new
Map
();
const
map
=
new
Map
();
for
(
const
item
of
cart
)
{
for
(
const
item
of
cart
)
{
if
(
!
map
.
has
(
item
.
shopperId
)){
if
(
!
map
.
has
(
item
.
shopperId
))
{
map
.
set
(
item
.
shopperId
,
true
);
// set any value to Map
map
.
set
(
item
.
shopperId
,
true
);
// set any value to Map
distinctShops
.
push
(
item
.
shopperId
);
distinctShops
.
push
(
item
.
shopperId
);
}
}
...
@@ -157,11 +157,11 @@ export class OrdersService {
...
@@ -157,11 +157,11 @@ export class OrdersService {
console
.
log
(
products
);
console
.
log
(
products
);
const
product
=
cartItem
[
0
];
const
product
=
cartItem
[
0
];
const
orderItem
:
Order
=
{
const
orderItem
:
Order
=
{
amount
:
'A$ '
+
prodPrice
,
amount
:
'A$ '
+
otherCharge
.
totalAmt
,
customer
:
firebase
.
firestore
().
doc
(
'/customer/'
+
this
.
custId
),
customer
:
firebase
.
firestore
().
doc
(
'/customer/'
+
this
.
custId
),
shopper
:
product
.
shopper
,
shopper
:
product
.
shopper
,
deliveryAddress
:
'Techware Software solution, Carnival Infopark, Kochi'
,
deliveryAddress
:
otherCharge
.
custAddress
,
deliveryCharge
:
'A$
0.5'
,
deliveryCharge
:
'A$
'
+
otherCharge
.
deliveryCharge
,
deliveryLocation
:
delivery
,
deliveryLocation
:
delivery
,
bookDate
:
firebase
.
firestore
.
FieldValue
.
serverTimestamp
(),
bookDate
:
firebase
.
firestore
.
FieldValue
.
serverTimestamp
(),
orderCode
:
this
.
orderCode
(),
orderCode
:
this
.
orderCode
(),
...
@@ -179,7 +179,10 @@ export class OrdersService {
...
@@ -179,7 +179,10 @@ export class OrdersService {
riderName
:
'John'
,
riderName
:
'John'
,
shopperState
:
0
,
shopperState
:
0
,
shopperName
:
'Witchery'
,
shopperName
:
'Witchery'
,
product
:
products
product
:
products
,
discount
:
'A$ '
+
otherCharge
.
discount
,
promoApplied
:
otherCharge
.
discountApplied
,
tax
:
'A$ '
+
otherCharge
.
taxAmount
};
};
console
.
log
(
orderItem
);
console
.
log
(
orderItem
);
...
...
This diff is collapsed.
Click to expand it.
src/config/services/myorder.ts
View file @
f215b4c0
...
@@ -3,6 +3,7 @@ export interface Myorder {
...
@@ -3,6 +3,7 @@ export interface Myorder {
bookDate
:
any
;
bookDate
:
any
;
pickupLocation
:
any
;
pickupLocation
:
any
;
deliveryLocation
:
any
;
deliveryLocation
:
any
;
deliveryAddress
:
any
;
status
:
number
;
status
:
number
;
orderStatus
:
number
;
orderStatus
:
number
;
riderName
:
string
;
riderName
:
string
;
...
...
This diff is collapsed.
Click to expand it.
src/config/services/order.ts
View file @
f215b4c0
...
@@ -64,6 +64,9 @@ export interface Order {
...
@@ -64,6 +64,9 @@ export interface Order {
status
:
number
;
status
:
number
;
shopperState
:
number
;
shopperState
:
number
;
product
:
any
;
product
:
any
;
tax
:
string
;
discount
:
string
;
promoApplied
:
boolean
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment