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
29c6bd46
Commit
29c6bd46
authored
Feb 11, 2020
by
Arjun
Browse files
Options
Browse Files
Download
Plain Diff
conflict fix
parents
47fe521c
8d6511ef
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
445 additions
and
239 deletions
+445
-239
app.component.ts
src/app/app.component.ts
+2
-1
cart.page.ts
src/app/cart/cart.page.ts
+49
-49
changedetails.page.html
src/app/changedetails/changedetails.page.html
+11
-8
changedetails.page.ts
src/app/changedetails/changedetails.page.ts
+13
-23
myorder.page.html
src/app/myorder/myorder.page.html
+5
-0
myorder.page.scss
src/app/myorder/myorder.page.scss
+134
-110
nearby.page.ts
src/app/nearby/nearby.page.ts
+1
-2
preference.page.html
src/app/preference/preference.page.html
+47
-29
preference.page.ts
src/app/preference/preference.page.ts
+88
-8
productlist.page.ts
src/app/productlist/productlist.page.ts
+1
-0
profile.page.html
src/app/profile/profile.page.html
+18
-1
profile.page.ts
src/app/profile/profile.page.ts
+13
-1
category.service.ts
src/config/category.service.ts
+50
-0
products.service.ts
src/config/products.service.ts
+4
-1
update.service.ts
src/config/update.service.ts
+9
-6
No files found.
src/app/app.component.ts
View file @
29c6bd46
...
...
@@ -113,7 +113,8 @@ export class AppComponent {
'feedback'
,
'wishlist'
,
'preference'
,
'changeaddress'
'changeaddress'
,
'changedetails'
];
const
currentUrl
=
this
.
router
.
url
.
split
(
'/'
);
const
index
=
restrictedUrl
.
findIndex
(
x
=>
x
===
currentUrl
[
1
]);
...
...
src/app/cart/cart.page.ts
View file @
29c6bd46
import
{
Component
,
OnInit
,
ViewChild
}
from
"@angular/core"
;
import
{
IonSlides
}
from
"@ionic/angular"
;
import
{
Location
}
from
"@angular/common"
;
import
{
Router
,
ActivatedRoute
}
from
"@angular/router"
;
import
{
CartsService
}
from
"./../../config/cart.service"
;
import
{
OrdersService
}
from
"./../../config/order.service"
;
import
{
ModalController
}
from
"@ionic/angular"
;
import
{
DeliverypopPage
}
from
"../deliverypop/deliverypop.page"
;
import
{
ServiceService
}
from
"./../../config/service.service"
;
import
{
AddressService
}
from
"./../../config/address.service"
;
import
{
AddressList
}
from
"./../../config/services/address"
;
import
{
trigger
,
transition
,
animate
,
style
}
from
"@angular/animations"
;
import
{
zip
}
from
"rxjs"
;
import
{
Component
,
OnInit
,
ViewChild
}
from
'@angular/core'
;
import
{
IonSlides
}
from
'@ionic/angular'
;
import
{
Location
}
from
'@angular/common'
;
import
{
Router
,
ActivatedRoute
}
from
'@angular/router'
;
import
{
CartsService
}
from
'./../../config/cart.service'
;
import
{
OrdersService
}
from
'./../../config/order.service'
;
import
{
ModalController
}
from
'@ionic/angular'
;
import
{
DeliverypopPage
}
from
'../deliverypop/deliverypop.page'
;
import
{
ServiceService
}
from
'./../../config/service.service'
;
import
{
AddressService
}
from
'./../../config/address.service'
;
import
{
AddressList
}
from
'./../../config/services/address'
;
import
{
trigger
,
transition
,
animate
,
style
}
from
'@angular/animations'
;
import
{
zip
}
from
'rxjs'
;
@
Component
({
selector
:
"app-cart"
,
templateUrl
:
"./cart.page.html"
,
styleUrls
:
[
"./cart.page.scss"
],
selector
:
'app-cart'
,
templateUrl
:
'./cart.page.html'
,
styleUrls
:
[
'./cart.page.scss'
],
animations
:
[
trigger
(
"slideInOut"
,
[
transition
(
":enter"
,
[
style
({
transform
:
"translateY(100%)"
}),
animate
(
"200ms ease-in"
,
style
({
transform
:
"translateY(0%)"
}))
trigger
(
'slideInOut'
,
[
transition
(
':enter'
,
[
style
({
transform
:
'translateY(100%)'
}),
animate
(
'200ms ease-in'
,
style
({
transform
:
'translateY(0%)'
}))
]),
transition
(
":leave"
,
[
animate
(
"200ms ease-out"
,
style
({
transform
:
"translateY(100%)"
}))
transition
(
':leave'
,
[
animate
(
'200ms ease-out'
,
style
({
transform
:
'translateY(100%)'
}))
])
])
]
...
...
@@ -61,7 +61,7 @@ export class CartPage implements OnInit {
public
service
:
ServiceService
,
public
addressService
:
AddressService
)
{
console
.
log
(
"cart loaded"
);
console
.
log
(
'cart loaded'
);
this
.
bookDate
=
this
.
formatDate
();
this
.
currentIndex
=
0
;
this
.
count
=
1
;
...
...
@@ -72,7 +72,7 @@ export class CartPage implements OnInit {
this
.
discount
=
0
;
// this.cartService.cartList();
this
.
loader
=
true
;
const
users
=
this
.
service
.
get
(
"user"
).
then
(
data
=>
{
const
users
=
this
.
service
.
get
(
'user'
).
then
(
data
=>
{
if
(
data
)
{
data
=
JSON
.
parse
(
data
);
this
.
custId
=
data
.
uid
;
...
...
@@ -90,7 +90,7 @@ export class CartPage implements OnInit {
}
ionViewWillEnter
()
{
const
users
=
this
.
service
.
get
(
"user"
).
then
(
data
=>
{
const
users
=
this
.
service
.
get
(
'user'
).
then
(
data
=>
{
if
(
data
)
{
data
=
JSON
.
parse
(
data
);
this
.
cartService
.
cartList
();
...
...
@@ -182,15 +182,15 @@ export class CartPage implements OnInit {
const
state
=
this
.
orderService
.
checkOut
(
this
.
cartService
.
carts
,
otherCharges
)
.
then
(
data
=>
{
console
.
log
(
"ready for slide"
);
console
.
log
(
'ready for slide'
);
const
timeStamp
=
Math
.
floor
(
Date
.
now
()
/
1000
);
this
.
timeinterval
=
setInterval
(()
=>
{
t
his
.
getDeliveryTime
(
timeStamp
);
T
his
.
getDeliveryTime
(
timeStamp
);
},
1000
);
this
.
slides
.
slideNext
();
});
}
else
{
alert
(
"Please choose delivery location"
);
alert
(
'Please choose delivery location'
);
}
}
else
{
this
.
slides
.
slideNext
();
...
...
@@ -203,9 +203,9 @@ export class CartPage implements OnInit {
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
;
const
seconds
=
t
.
seconds
<
10
?
"0"
+
t
.
seconds
:
t
.
seconds
;
this
.
deliveryTime
=
minutes
+
" : "
+
seconds
;
const
minutes
=
t
.
minutes
<
10
?
'0'
+
t
.
minutes
:
t
.
minutes
;
const
seconds
=
t
.
seconds
<
10
?
'0'
+
t
.
seconds
:
t
.
seconds
;
this
.
deliveryTime
=
minutes
+
' : '
+
seconds
;
if
(
t
.
t
<=
0
)
{
clearInterval
(
this
.
timeinterval
);
}
...
...
@@ -285,33 +285,33 @@ export class CartPage implements OnInit {
formatDate
()
{
const
date
=
new
Date
();
const
months
=
[
"Jan"
,
"Feb"
,
"Mar"
,
"Apr"
,
"May"
,
"June"
,
"July"
,
"Aug"
,
"Sep"
,
"Oct"
,
"Nov"
,
"Dec"
'Jan'
,
'Feb'
,
'Mar'
,
'Apr'
,
'May'
,
'June'
,
'July'
,
'Aug'
,
'Sep'
,
'Oct'
,
'Nov'
,
'Dec'
];
let
hours
=
date
.
getHours
();
const
minutes
=
date
.
getMinutes
();
const
ampm
=
hours
>=
12
?
"PM"
:
"AM"
;
const
ampm
=
hours
>=
12
?
'PM'
:
'AM'
;
hours
=
hours
%
12
;
hours
=
hours
?
hours
:
12
;
// the hour '0' should be '12'
const
newminutes
=
minutes
<
10
?
"0"
+
minutes
:
minutes
;
const
strTime
=
hours
+
":"
+
newminutes
+
" "
+
ampm
;
const
newminutes
=
minutes
<
10
?
'0'
+
minutes
:
minutes
;
const
strTime
=
hours
+
':'
+
newminutes
+
' '
+
ampm
;
return
(
months
[
date
.
getMonth
()]
+
" "
+
' '
+
date
.
getDate
()
+
","
+
','
+
date
.
getFullYear
()
+
" "
+
' '
+
strTime
);
}
...
...
src/app/changedetails/changedetails.page.html
View file @
29c6bd46
...
...
@@ -26,7 +26,7 @@
/>
<div
class=
"md-errors-spacer"
[
hidden
]="
name
.
valid
||
submitted =
=
false
"
[
hidden
]="
name
.
valid
"
class=
"ion-padding-start"
>
Name is required
...
...
@@ -56,10 +56,7 @@
placeholder=
"Change your Phone Number"
#
phone=
"ngModel"
/>
<div
class=
"md-errors-spacer"
[
hidden
]="
phone
.
valid
||
submitted =
=
false
"
>
<div
class=
"md-errors-spacer"
[
hidden
]="
phone
.
valid
"
>
<div
*
ngIf=
"phone.errors && phone.errors.required"
>
Phone number is required
</div>
...
...
@@ -113,14 +110,20 @@
[
required
]="
currentPassword
?
true:
false
"
placeholder=
"Confirm Password"
/>
<div
*
ngIf=
"confirmPassword.errors"
>
{{confPasswordErr}}
<div
*
ngIf=
"confirmPassword.value !=='' && confirmPassword.value !== password.value"
>
Password should match
</div>
</div>
</div>
<div
class=
"row"
>
<button
class=
"login_btn"
(
click
)="
onFormSubmit
(
updateForm
)"
>
<button
class=
"login_btn"
(
click
)="
onFormSubmit
(
updateForm
)"
[
disabled
]="!
phone
.
valid
||
!
name
.
valid
"
>
UPDATE
</button>
</div>
...
...
src/app/changedetails/changedetails.page.ts
View file @
29c6bd46
...
...
@@ -61,30 +61,20 @@ export class ChangedetailsPage implements OnInit {
onFormSubmit
(
form
:
NgForm
)
{
this
.
submitted
=
true
;
console
.
log
(
form
.
value
);
if
(
form
.
valid
)
{
// Change Password
if
(
form
.
value
.
currentPassword
&&
form
.
value
.
password
)
{
if
(
form
.
value
.
password
&&
form
.
value
.
password
===
form
.
value
.
confirmPassword
)
{
// this.register.updateData(form.value, this.userData.uid);
this
.
register
.
updatePassword
(
form
.
value
.
currentPassword
,
form
.
value
.
password
);
console
.
log
(
'Password Changed and profile updated'
),
form
.
value
;
}
else
{
console
.
log
(
'Password should match'
);
this
.
confPasswordErr
=
'Password should match'
;
}
}
else
{
// this.register.updateData(form.value, this.userData);
console
.
log
(
'profile updated'
,
form
.
value
);
}
// console.log('valid form values', form.value);
// if (form.valid) {
// Change Password
if
(
form
.
value
.
currentPassword
&&
form
.
value
.
password
&&
form
.
value
.
password
===
form
.
value
.
confirmPassword
)
{
this
.
register
.
updateData
(
form
.
value
,
this
.
userData
.
uid
);
this
.
register
.
updatePassword
(
form
.
value
.
currentPassword
,
form
.
value
.
password
);
}
else
{
console
.
log
(
form
);
this
.
register
.
updateData
(
form
.
value
,
this
.
userData
);
console
.
log
(
'profile updated'
,
form
.
value
);
}
}
}
src/app/myorder/myorder.page.html
View file @
29c6bd46
...
...
@@ -109,6 +109,11 @@
<div class="clear"></div>
</li> -->
</ul>
<div
class=
"empty-wishlist-wrapper"
*
ngIf=
"myorder.orders.length == 0"
>
<img
src=
"../../assets/wishlist.png"
/>
<h1>
There is no order
</h1>
<button
(
click
)="
goToPage
('
home
')"
>
shop now
</button>
</div>
</div>
</ion-content>
<div
class=
"loader"
*
ngIf=
"loader"
>
...
...
src/app/myorder/myorder.page.scss
View file @
29c6bd46
.myorder_wrapper
{
ul
{
margin
:
0px
;
padding
:
10px
;
li
{
list-style
:
none
;
padding
:
10px
;
padding-bottom
:
15px
;
.order_info
{
padding-top
:
10px
;
padding-bottom
:
10px
;
h5
{
margin
:
0px
;
padding
:
0px
;
}
.order_track
{
background-color
:
rgba
(
53
,
203
,
171
,
1
);
color
:
#fff
;
border-radius
:
3px
;
padding
:
3px
;
padding-left
:
10px
;
padding-right
:
10px
;
}
}
.order_image
{
width
:
90px
;
height
:
90px
;
float
:
left
;
border-radius
:
8px
;
background-color
:
#a8a8a8
;
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
object-position
:
center
;
}
}
.order_detail
{
width
:
calc
(
100%
-
190px
);
float
:
left
;
padding-left
:
20px
;
h5
{
margin
:
0px
;
padding
:
0px
;
color
:
rgba
(
176
,
174
,
199
,
1
);
font-size
:
16px
;
padding-top
:
3px
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
width
:
100%
;
span
{
color
:
#29285b
;
}
}
h6
{
margin
:
0px
;
padding
:
0px
;
color
:
rgba
(
176
,
174
,
199
,
1
);
font-size
:
12px
;
padding-top
:
9px
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
}
p
{
margin
:
0px
;
padding
:
0px
;
color
:
rgba
(
59
,
57
,
77
,
1
);
font-weight
:
900
;
padding-top
:
10px
;
font-size
:
20px
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
}
}
.order_other
{
width
:
100px
;
float
:
right
;
h6
{
margin
:
0px
;
padding
:
0px
;
color
:
rgba
(
176
,
174
,
199
,
1
);
font-size
:
12px
;
padding-top
:
9px
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
padding-bottom
:
10px
;
}
h5
{
margin
:
0px
;
padding
:
0px
;
color
:
rgba
(
206
,
153
,
76
,
1
);
font-size
:
16px
;
font-weight
:
bold
;
}
.track_btn
{
background
:
#29285b
;
color
:
#FFF
;
float
:
right
;
padding
:
12px
;
font-size
:
18px
;
border-radius
:
5px
;
padding-left
:
15px
;
padding-right
:
15px
;
}
}
ul
{
margin
:
0px
;
padding
:
10px
;
li
{
list-style
:
none
;
padding
:
10px
;
padding-bottom
:
15px
;
.order_info
{
padding-top
:
10px
;
padding-bottom
:
10px
;
h5
{
margin
:
0px
;
padding
:
0px
;
}
.order_track
{
background-color
:
rgba
(
53
,
203
,
171
,
1
);
color
:
#fff
;
border-radius
:
3px
;
padding
:
3px
;
padding-left
:
10px
;
padding-right
:
10px
;
}
}
.order_image
{
width
:
90px
;
height
:
90px
;
float
:
left
;
border-radius
:
8px
;
background-color
:
#a8a8a8
;
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
object-position
:
center
;
}
}
.order_detail
{
width
:
calc
(
100%
-
190px
);
float
:
left
;
padding-left
:
20px
;
h5
{
margin
:
0px
;
padding
:
0px
;
color
:
rgba
(
176
,
174
,
199
,
1
);
font-size
:
16px
;
padding-top
:
3px
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
width
:
100%
;
span
{
color
:
#29285b
;
}
}
h6
{
margin
:
0px
;
padding
:
0px
;
color
:
rgba
(
176
,
174
,
199
,
1
);
font-size
:
12px
;
padding-top
:
9px
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
}
p
{
margin
:
0px
;
padding
:
0px
;
color
:
rgba
(
59
,
57
,
77
,
1
);
font-weight
:
900
;
padding-top
:
10px
;
font-size
:
20px
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
}
}
.order_other
{
width
:
100px
;
float
:
right
;
h6
{
margin
:
0px
;
padding
:
0px
;
color
:
rgba
(
176
,
174
,
199
,
1
);
font-size
:
12px
;
padding-top
:
9px
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
padding-bottom
:
10px
;
}
h5
{
margin
:
0px
;
padding
:
0px
;
color
:
rgba
(
206
,
153
,
76
,
1
);
font-size
:
16px
;
font-weight
:
bold
;
}
.track_btn
{
background
:
#29285b
;
color
:
#fff
;
float
:
right
;
padding
:
12px
;
font-size
:
18px
;
border-radius
:
5px
;
padding-left
:
15px
;
padding-right
:
15px
;
}
}
}
}
.empty-wishlist-wrapper
{
text-align
:
center
;
padding-top
:
25%
;
img
{
width
:
100px
;
}
h1
{
font-size
:
18px
;
font-weight
:
bolder
;
text-transform
:
uppercase
;
color
:
#3b394d
;
}
button
{
background-color
:
#29285b
;
border-radius
:
8px
;
height
:
50px
;
width
:
48%
;
color
:
#fff
;
font-size
:
18px
;
font-weight
:
lighter
;
text-transform
:
uppercase
;
margin-top
:
10px
;
}
}
\ No newline at end of file
}
}
src/app/nearby/nearby.page.ts
View file @
29c6bd46
...
...
@@ -134,8 +134,7 @@ export class NearbyPage implements OnInit {
this
.
loader
=
false
;
this
.
successState
=
false
;
if
(
this
.
type
===
1
)
{
this
.
service
.
set
(
'type'
,
0
);
this
.
router
.
navigateByUrl
(
'home'
,
{
queryParams
:
null
});
this
.
router
.
navigateByUrl
(
'preference'
,
{
queryParams
:
null
});
}
else
{
this
.
goBack
();
}
...
...
src/app/preference/preference.page.html
View file @
29c6bd46
<div
class=
"nav_header"
>
<button
class=
"nav_btn nav_back floatLeft"
(
click
)="
goBack
()
"
>
<img
src=
"../assets/Group17_2.png"
/>
</button>
<div
class=
"nav_title floatLeft"
>
<h4>
Preference
</h4>
</div>
<div
class=
"clear"
></div>
<button
class=
"nav_btn nav_back floatLeft"
(
click
)="
goBack
()"
*
ngIf=
"type==0
"
>
<img
src=
"../assets/Group17_2.png"
/>
</button>
<div
class=
"nav_title floatLeft"
>
<h4>
Preferences
</h4>
</div>
<div
class=
"clear"
></div>
</div>
<ion-content>
<div
class=
"preference-wrapper"
>
<div
class=
"pref-wrap-two"
>
<ion-grid>
<ion-row
*
ngIf=
"categoriesService.activecategories && categoriesService.activecategories.length > 0"
>
<ion-col
size=
"6"
*
ngFor=
"let categories of categoriesService.activecategories"
>
<div
class=
"preference-box"
>
<input
type=
"checkbox"
class=
"preference"
/>
<img
[
src
]="
categories
.
catImage
"
onerror=
"this.src='../assets/handsome-man-outdoors-drinking-coffee-with-sunglasses-guy-with-beard-instagram-effect_1212-818@3x.png'"
>
<h1>
{{categories.catName}}
</h1>
</div>
</ion-col>
</ion-row>
</ion-grid>
</div>
<div
class=
"bottom-button"
>
<button
class=
"show-btn"
(
click
)="
goToPage
('
nearby
')"
>
Continue
</button>
<span>
SKIP
</span>
</div>
<div
class=
"preference-wrapper"
>
<div
class=
"pref-wrap-two"
>
<ion-grid>
<ion-row
*
ngIf=
"categoriesService.activecategories && categoriesService.activecategories.length > 0"
>
<ion-col
size=
"6"
*
ngFor=
"let categories of categoriesService.categories"
>
<div
class=
"preference-box"
>
<input
type=
"checkbox"
class=
"preference"
(
click
)="
selectPrefernce
(
categories
.
catId
)"
[
checked
]="
selectedPref
(
categories
.
catId
)"
/>
<img
[
src
]="
categories
.
catImage
"
onerror=
"this.src='../assets/handsome-man-outdoors-drinking-coffee-with-sunglasses-guy-with-beard-instagram-effect_1212-818@3x.png'"
/>
<h1>
{{categories.catName}}
</h1>
</div>
</ion-col>
</ion-row>
</ion-grid>
</div>
<div
class=
"bottom-button"
>
<button
class=
"show-btn"
(
click
)="
onSubmit
()"
>
Continue
</button>
<!-- <span>SKIP</span> -->
</div>
</ion-content>
\ No newline at end of file
</div>
</ion-content>
<div
class=
"loader"
*
ngIf=
"loader"
>
<div
class=
"lds-ripple"
>
<div></div>
<div></div>
</div>
</div>
src/app/preference/preference.page.ts
View file @
29c6bd46
import
{
Component
,
OnInit
}
from
"@angular/core"
;
import
{
CategoriesService
}
from
"./../../config/category.service"
;
import
{
ServiceService
}
from
"./../../config/service.service"
;
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
CategoriesService
}
from
'./../../config/category.service'
;
import
{
ServiceService
}
from
'./../../config/service.service'
;
import
{
Router
,
ActivatedRoute
}
from
'@angular/router'
;
@
Component
({
selector
:
"app-preference"
,
templateUrl
:
"./preference.page.html"
,
styleUrls
:
[
"./preference.page.scss"
]
selector
:
'app-preference'
,
templateUrl
:
'./preference.page.html'
,
styleUrls
:
[
'./preference.page.scss'
]
})
export
class
PreferencePage
implements
OnInit
{
type
:
any
;
successState
:
boolean
;
uid
:
any
;
userPrefence
:
any
[];
loader
:
boolean
;
constructor
(
private
categoriesService
:
CategoriesService
,
private
service
:
ServiceService
)
{}
private
service
:
ServiceService
,
private
router
:
Router
)
{
this
.
successState
=
false
;
this
.
userPrefence
=
[];
this
.
type
=
0
;
const
users
=
this
.
service
.
get
(
'user'
).
then
(
data
=>
{
if
(
data
)
{
data
=
JSON
.
parse
(
data
);
this
.
uid
=
data
.
uid
;
this
.
categoriesService
.
preference
(
this
.
uid
)
.
then
(
datas
=>
{
console
.
log
(
datas
);
console
.
log
(
this
.
categoriesService
.
preferenceList
);
this
.
userPrefence
=
this
.
categoriesService
.
preferenceList
;
console
.
log
(
this
.
userPrefence
);
})
.
catch
(
err
=>
{
this
.
userPrefence
=
[];
});
}
});
this
.
service
.
get
(
'type'
).
then
(
data
=>
{
this
.
type
=
data
;
});
}
ngOnInit
()
{}
selectPrefernce
(
preferenceId
)
{
console
.
log
(
this
.
userPrefence
);
console
.
log
(
preferenceId
);
if
(
this
.
userPrefence
)
{
const
index
=
this
.
userPrefence
.
findIndex
(
x
=>
x
===
preferenceId
);
if
(
index
>
-
1
)
{
this
.
userPrefence
.
splice
(
index
,
1
);
}
else
{
this
.
userPrefence
.
push
(
preferenceId
);
}
}
else
{
this
.
userPrefence
=
[];
this
.
userPrefence
.
push
(
preferenceId
);
}
}
onSubmit
()
{
this
.
loader
=
true
;
console
.
log
(
this
.
userPrefence
);
this
.
categoriesService
.
preferenceCreate
(
this
.
userPrefence
,
this
.
uid
);
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
);
}
selectedPref
(
preferenceId
)
{
const
index
=
this
.
userPrefence
.
findIndex
(
x
=>
x
===
preferenceId
);
console
.
log
(
index
);
if
(
index
>
-
1
)
{
return
true
;
}
else
{
return
false
;
}
}
goBack
()
{
window
.
history
.
back
();
}
}
src/app/productlist/productlist.page.ts
View file @
29c6bd46
...
...
@@ -66,6 +66,7 @@ export class ProductlistPage implements OnInit {
ngOnInit
()
{}
ionViewWillEnter
()
{
console
.
log
(
'logged'
);
const
users
=
this
.
service
.
get
(
'user'
).
then
(
data
=>
{
if
(
data
)
{
data
=
JSON
.
parse
(
data
);
...
...
src/app/profile/profile.page.html
View file @
29c6bd46
...
...
@@ -18,7 +18,7 @@
<div
class=
"profile_circle"
>
<img
[
src
]="
loggedUser
.
profilePhoto
"
onerror=
"this.src='./../
../assets/profile_banne
r.png'"
onerror=
"this.src='./../
assets/asset_avata
r.png'"
/>
<div
class=
"edit"
></div>
<input
type=
"file"
accept=
"image/*"
(
change
)="
fileChange
($
event
)"
/>
...
...
@@ -118,6 +118,17 @@
</ion-col>
</ion-row>
<hr
/>
<ion-row
(
click
)="
goToPage
('
preference
')"
>
<ion-col
class=
"textLeft p0"
>
<p>
Preferences
</p>
</ion-col>
<ion-col
class=
"textRight p0"
>
<h6>
<ion-icon
name=
"arrow-forward"
></ion-icon>
</h6>
</ion-col>
</ion-row>
<hr
/>
<ion-row>
<ion-col
class=
"textLeft p0"
>
<p>
Currency
</p>
...
...
@@ -150,3 +161,9 @@
</div>
</div>
</ion-content>
<div
class=
"loader"
*
ngIf=
"loader"
>
<div
class=
"lds-ripple"
>
<div></div>
<div></div>
</div>
</div>
src/app/profile/profile.page.ts
View file @
29c6bd46
...
...
@@ -3,6 +3,7 @@ import { User } from '../../config/services/user';
import
{
UserService
}
from
'../../config/user.service'
;
import
{
ServiceService
}
from
'../../config/service.service'
;
import
{
AuthService
}
from
'../../config/auth.service'
;
import
{
SubjectService
}
from
'./../../config/subject.service'
;
import
{
Router
,
ActivatedRoute
}
from
'@angular/router'
;
import
{
finalize
,
tap
}
from
'rxjs/operators'
;
import
{
Location
}
from
'@angular/common'
;
...
...
@@ -40,6 +41,7 @@ export class ProfilePage implements OnInit {
loggedUser
:
any
;
ref
:
AngularFireStorageReference
;
downloadURL
;
loader
:
boolean
;
constructor
(
private
route
:
ActivatedRoute
,
...
...
@@ -50,8 +52,10 @@ export class ProfilePage implements OnInit {
private
authService
:
AuthService
,
private
addressService
:
AddressService
,
private
wishService
:
WishService
,
private
location
:
Location
private
location
:
Location
,
private
subject
:
SubjectService
)
{
this
.
loader
=
false
;
this
.
service
.
get
(
'user'
).
then
(
data
=>
{
if
(
data
)
{
this
.
userData
=
JSON
.
parse
(
data
);
...
...
@@ -95,6 +99,7 @@ export class ProfilePage implements OnInit {
}
async
fileChange
(
event
)
{
this
.
loader
=
true
;
const
fileList
:
FileList
=
event
.
target
.
files
;
if
(
fileList
.
length
>
0
)
{
const
reader
=
new
FileReader
();
...
...
@@ -119,7 +124,14 @@ export class ProfilePage implements OnInit {
.
pipe
(
finalize
(()
=>
{
ref
.
getDownloadURL
().
subscribe
(
url
=>
{
this
.
loader
=
false
;
this
.
authService
.
profilePic
(
url
);
this
.
service
.
get
(
'userData'
).
then
(
userData
=>
{
const
userDatas
=
JSON
.
parse
(
userData
);
userDatas
.
profilePhoto
=
url
;
this
.
service
.
set
(
'userData'
,
JSON
.
stringify
(
userDatas
));
this
.
subject
.
sendUserData
(
JSON
.
stringify
(
userDatas
));
});
});
})
)
...
...
src/config/category.service.ts
View file @
29c6bd46
...
...
@@ -14,7 +14,9 @@ import { ServiceService } from './service.service';
export
class
CategoriesService
{
categories
:
Category
[]
=
[];
activecategories
:
Category
[]
=
[];
preferenceList
:
any
[];
constructor
(
public
afs
:
AngularFirestore
,
public
service
:
ServiceService
)
{
this
.
preferenceList
=
[];
this
.
categoryList
();
this
.
activeCategory
();
}
...
...
@@ -74,4 +76,52 @@ export class CategoriesService {
}
});
}
public
async
preference
(
custId
)
{
const
This
=
this
;
const
state
=
true
;
const
promise
=
new
Promise
(
resolve
=>
{
const
orderRef
:
AngularFirestoreDocument
<
any
>
=
this
.
afs
.
collection
(
'preference'
)
.
doc
(
custId
);
orderRef
.
valueChanges
().
subscribe
(
value
=>
{
console
.
log
(
value
);
this
.
preferenceList
=
[];
if
(
value
)
{
console
.
log
(
value
);
// tslint:disable-next-line: forin
for
(
const
index
in
value
)
{
console
.
log
(
index
);
this
.
preferenceList
.
push
(
index
);
resolve
(
this
.
preferenceList
);
}
resolve
();
// console.log(this.activecategories);
}
else
{
this
.
preferenceList
=
[];
resolve
([]);
}
});
});
return
promise
;
}
preferenceCreate
(
preferData
,
custId
)
{
if
(
preferData
.
length
>
0
)
{
const
preferArray
=
[];
preferData
.
forEach
(
element
=>
{
preferArray
[
element
]
=
true
;
});
const
pref
=
Object
.
assign
({},
preferArray
);
this
.
afs
.
collection
(
'preference'
)
.
doc
(
custId
)
.
set
(
pref
);
}
else
{
this
.
afs
.
collection
(
'preference'
)
.
doc
(
custId
)
.
delete
();
}
}
}
src/config/products.service.ts
View file @
29c6bd46
...
...
@@ -235,6 +235,7 @@ export class ProductsService {
}
public
async
getFavlist
(
userId
:
string
)
{
console
.
log
(
userId
);
const
favRef
:
AngularFirestoreDocument
<
any
>
=
this
.
afs
.
collection
(
`favourite`
)
.
doc
(
userId
);
...
...
@@ -247,9 +248,11 @@ export class ProductsService {
if
(
value
!==
undefined
)
{
if
(
Object
.
keys
(
value
).
length
>
0
)
{
this
.
fav
=
this
.
service
.
splitSep
(
value
);
//
console.log(this.fav);
console
.
log
(
this
.
fav
);
}
// console.log(value);
}
else
{
this
.
fav
=
[];
}
});
}
...
...
src/config/update.service.ts
View file @
29c6bd46
...
...
@@ -9,6 +9,7 @@ import {
AngularFirestoreCollection
}
from
'@angular/fire/firestore'
;
import
{
ServiceService
}
from
'./../config/service.service'
;
import
{
SubjectService
}
from
'./../config/subject.service'
;
import
{
GooglePlus
}
from
'@ionic-native/google-plus/ngx'
;
import
{
take
}
from
'rxjs/operators'
;
import
{
from
}
from
'rxjs'
;
...
...
@@ -27,7 +28,8 @@ export class UpdateService {
public
afs
:
AngularFirestore
,
public
afAuth
:
AngularFireAuth
,
private
router
:
Router
,
private
service
:
ServiceService
private
service
:
ServiceService
,
private
subject
:
SubjectService
)
{
// this.type = 1;
// this.afAuth.authState.subscribe(user => {
...
...
@@ -72,10 +74,11 @@ export class UpdateService {
this
.
service
.
set
(
'userData'
,
JSON
.
stringify
(
updateOldData
))
.
then
(
res
=>
{
this
.
subject
.
sendUserData
(
JSON
.
stringify
(
updateOldData
));
console
.
log
(
'success'
,
updateOldData
,
res
);
this
.
service
.
showToast
(
'Profile updated!'
,
'top'
,
'my-toast'
,
1000
)
.
then
(
res
=>
{
.
then
(
()
=>
{
this
.
router
.
navigateByUrl
(
'profile'
);
this
.
loader
=
false
;
});
...
...
@@ -91,7 +94,7 @@ export class UpdateService {
updatePassword
(
currentPassword
:
string
,
newPasswd
:
string
)
{
this
.
loader
=
true
;
le
t
currentUser
=
this
.
afAuth
.
auth
.
currentUser
;
// Gets current user
cons
t
currentUser
=
this
.
afAuth
.
auth
.
currentUser
;
// Gets current user
// Credential is required for re-authentication
const
credential
=
auth
.
EmailAuthProvider
.
credential
(
currentUser
.
email
,
...
...
@@ -108,7 +111,7 @@ export class UpdateService {
console
.
log
(
'password changed'
);
this
.
loader
=
false
;
this
.
service
.
showToast
(
'Password Changed!'
,
'top'
,
'my-toast'
,
1000
)
//success toast
.
showToast
(
'Password Changed!'
,
'top'
,
'my-toast'
,
1000
)
//
success toast
.
then
(
res
=>
{
this
.
router
.
navigateByUrl
(
'profile'
);
this
.
loader
=
false
;
...
...
@@ -117,7 +120,7 @@ export class UpdateService {
.
catch
(
error
=>
{
console
.
log
(
'something fishy'
);
this
.
service
.
showToast
(
'Something went wrong'
,
'top'
,
'my-toast'
,
1000
)
//failure toast
.
showToast
(
'Something went wrong'
,
'top'
,
'my-toast'
,
1000
)
//
failure toast
.
then
(
res
=>
{
this
.
loader
=
false
;
});
...
...
@@ -126,7 +129,7 @@ export class UpdateService {
.
catch
(
error
=>
{
console
.
log
(
error
);
this
.
service
.
showToast
(
error
.
message
,
'top'
,
'my-error'
,
3000
)
//failure toast
.
showToast
(
error
.
message
,
'top'
,
'my-error'
,
3000
)
//
failure toast
.
then
(
res
=>
{
this
.
loader
=
false
;
});
...
...
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