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
69a0537c
Commit
69a0537c
authored
Feb 06, 2020
by
muhsin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added toast for cart and disabled multiple cart clicks
parent
6abb0eb2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
22 deletions
+30
-22
nearby.page.scss
src/app/nearby/nearby.page.scss
+1
-2
productdetail.page.html
src/app/productdetail/productdetail.page.html
+5
-1
productdetail.page.ts
src/app/productdetail/productdetail.page.ts
+24
-19
No files found.
src/app/nearby/nearby.page.scss
View file @
69a0537c
...
...
@@ -46,8 +46,7 @@
padding
:
0px
;
font-weight
:
800
;
}
p
{
}
input
{
width
:
100%
;
height
:
45px
;
...
...
src/app/productdetail/productdetail.page.html
View file @
69a0537c
...
...
@@ -277,7 +277,11 @@
<div
class=
"footer_options"
>
<button
class=
"share"
></button>
<button
class=
"fav"
></button>
<button
class=
"cart"
(
click
)="
buyNow
(
product
,
0
)"
></button>
<button
class=
"cart"
[
disabled
]="!
disCart
"
(
click
)="
buyNow
(
product
,
0
)"
></button>
</div>
<div
class=
"footer_btn"
(
click
)="
buyNow
(
product
,
1
)"
>
BUY NOW
</div>
</div>
...
...
src/app/productdetail/productdetail.page.ts
View file @
69a0537c
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
{
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
{
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
;
slide
:
Slides
;
product
:
Products
;
order
:
Order
;
...
...
@@ -53,7 +54,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
();
...
...
@@ -130,9 +131,13 @@ export class ProductdetailPage implements OnInit {
buyNow
(
product
:
any
,
type
:
number
)
{
this
.
cartService
.
buyNow
(
product
).
then
(()
=>
{
if
(
type
===
1
)
{
this
.
router
.
navigateByUrl
(
'cart'
);
this
.
router
.
navigateByUrl
(
"cart"
);
}
else
{
// alert('Product added to cart');
this
.
disCart
=
false
;
this
.
service
.
showToast
(
"Product added to cart"
,
"top"
,
"my-toast"
,
500
);
setTimeout
(()
=>
{
this
.
disCart
=
true
;
},
600
);
}
this
.
cartService
.
cartList
();
});
...
...
@@ -144,7 +149,7 @@ export class ProductdetailPage implements OnInit {
checkFavStatus
(
index
)
{
const
state
=
this
.
prodService
.
fav
.
findIndex
(
x
=>
x
===
index
);
return
state
>
-
1
?
'fav_fill'
:
'fav_icon'
;
return
state
>
-
1
?
"fav_fill"
:
"fav_icon"
;
}
changeFav
(
index
)
{
...
...
@@ -153,10 +158,10 @@ export class ProductdetailPage implements OnInit {
// 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);
...
...
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