Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dcarfixers_angular
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
16
Issues
16
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
Tobin
dcarfixers_angular
Commits
2e8a234a
Commit
2e8a234a
authored
Jan 11, 2019
by
Tobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
daily commit
parent
3123a4e6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
130 additions
and
17 deletions
+130
-17
dashboard.component.html
src/app/home/dashboard/dashboard.component.html
+0
-0
dashboard.component.scss
src/app/home/dashboard/dashboard.component.scss
+5
-0
dashboard.component.ts
src/app/home/dashboard/dashboard.component.ts
+71
-1
index.component.html
src/app/home/index/index.component.html
+8
-4
index.component.scss
src/app/home/index/index.component.scss
+17
-0
index.component.ts
src/app/home/index/index.component.ts
+29
-12
No files found.
src/app/home/dashboard/dashboard.component.html
View file @
2e8a234a
This diff is collapsed.
Click to expand it.
src/app/home/dashboard/dashboard.component.scss
View file @
2e8a234a
...
...
@@ -537,4 +537,8 @@
}
}
}
}
.address_height
{
height
:
65px
!
important
;
}
\ No newline at end of file
src/app/home/dashboard/dashboard.component.ts
View file @
2e8a234a
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Router
,
ActivatedRoute
}
from
'@angular/router'
;
import
{
FormGroup
,
FormControl
,
Validators
,
ValidationErrors
}
from
'@angular/forms'
;
import
{
ValidationService
}
from
'./../../provider/validation.service'
;
import
{
WebService
}
from
'./../../provider/web.service'
;
import
{
SubjectService
}
from
'./../../provider/subject.service'
;
import
{
ImageStorage
}
from
'../../../environments/server.config'
;
@
Component
({
selector
:
'app-dashboard'
,
...
...
@@ -7,11 +12,76 @@ import { Router, ActivatedRoute } from '@angular/router';
styleUrls
:
[
'./dashboard.component.scss'
]
})
export
class
DashboardComponent
implements
OnInit
{
tab
:
any
;
constructor
(
private
router
:
Router
)
{
}
loader
:
boolean
;
editProfile
;
user_name
:
string
;
loginDetails
:
any
;
loginResponse
:
any
;
editProfileSubmitClick
:
boolean
;
constructor
(
private
router
:
Router
,
private
route
:
ActivatedRoute
,
public
errorMsg
:
ValidationService
,
public
webService
:
WebService
,
public
subjectService
:
SubjectService
)
{
this
.
loader
=
false
;
this
.
editProfileSubmitClick
=
false
;
}
ngOnInit
()
{
this
.
loginResponse
.
status
=
"success"
;
this
.
loginResponse
.
message
=
"message"
;
this
.
tab
=
'active'
;
this
.
subjectService
.
getLoginData
().
subscribe
(
loginData
=>
{
this
.
loginDetails
=
JSON
.
parse
(
this
.
webService
.
getLocalStorageItem
(
'userData'
));
if
(
this
.
loginDetails
){
console
.
log
(
this
.
loginDetails
);
this
.
editProfile
=
new
FormGroup
({
email
:
new
FormControl
(
this
.
loginDetails
.
email
,
[
Validators
.
required
,
Validators
.
maxLength
(
50
),
Validators
.
pattern
(
'^[a-z0-9._%+-]+@[a-z0-9.-]+
\
.[a-z]{2,4}$'
)]),
phone
:
new
FormControl
(
this
.
loginDetails
.
phone
,
[
Validators
.
required
,
Validators
.
maxLength
(
15
),
Validators
.
pattern
(
"^[0-9
\
( ) + , - ]+$"
)]),
address
:
new
FormControl
(
this
.
loginDetails
.
address
,
[
Validators
.
required
,
Validators
.
maxLength
(
250
)]),
password
:
new
FormControl
(
''
,
[
Validators
.
maxLength
(
16
),
Validators
.
minLength
(
6
)]),
cpassword
:
new
FormControl
(
''
,
[
Validators
.
maxLength
(
16
),
Validators
.
minLength
(
6
)]),
last_name
:
new
FormControl
(
this
.
loginDetails
.
last_name
,
[
Validators
.
required
,
Validators
.
maxLength
(
50
),
Validators
.
pattern
(
"^[a-zA-Z
\
_ - '
\
/]+$"
)]),
first_name
:
new
FormControl
(
this
.
loginDetails
.
first_name
,
[
Validators
.
required
,
Validators
.
maxLength
(
50
),
Validators
.
pattern
(
"^[a-zA-Z
\
_ - '
\
/]+$"
)])
});
}
else
{
this
.
router
.
navigate
([
'index'
]);
}
});
}
submitProfileEdit
(
data
){
if
(
this
.
editProfile
.
invalid
){
return
false
;
}
const
This
=
this
;
this
.
loader
=
true
;
let
funcName
=
'edit_customer_profile'
;
this
.
webService
.
post_data
(
funcName
,
data
).
subscribe
(
response
=>
{
this
.
loader
=
false
;
if
(
response
.
status
==
'1'
)
{
this
.
webService
.
setLocalStorageItem
(
'userData'
,
JSON
.
stringify
(
response
.
data
));
this
.
subjectService
.
sendLoginData
(
'logged_in'
);
this
.
editProfile
.
nativeElement
.
click
();
}
else
{
response
.
status
=
'error'
;
response
.
message
=
(
response
.
message
==
''
)?
this
.
errorMsg
.
errorList
.
req_failure
:
response
.
message
;
this
.
editProfile
=
response
;
}
},
error
=>
{
this
.
editProfile
=
{
'status'
:
'error'
,
'message'
:
this
.
errorMsg
.
errorList
.
req_failure
};
},()
=>
{
// setTimeout( function() {
// This.loginResponse = false;
// }, 2000)
});
}
routeToIndex
(){
...
...
src/app/home/index/index.component.html
View file @
2e8a234a
...
...
@@ -243,7 +243,7 @@
<div
class=
"modal"
id=
"wizard"
>
<div
class=
"modal-dialog modal-full"
>
<div
class=
"modal-content login_modal_wrapper"
>
<div
class=
"modal_close"
data-dismiss=
"modal"
(
click
)="
resetWizard
()"
>
<div
#
closeWizard
class=
"modal_close"
data-dismiss=
"modal"
(
click
)="
resetWizard
()"
>
×
</div>
<div
class=
"modal-body"
>
...
...
@@ -413,7 +413,7 @@
<div
class=
"col-md-12 textCenter"
>
<button
*
ngIf=
"!loginDetails"
(
click
)="
resetForm
()"
class=
"wizard_signin"
type=
"button"
data-toggle=
"modal"
data-target=
"#login"
>
SIGN IN
</button>
<button
(
click
)="
getQuote
()"
class=
"wizard_quotes"
type=
"button"
data-toggle=
"modal"
data-target=
"#quotes"
>
VIEW SERVICE QUOTE
</button>
<input
type=
"hidden"
#
indexLoginModal
data-toggle=
"modal"
data-target=
"#
quotes
"
>
<input
type=
"hidden"
#
indexLoginModal
data-toggle=
"modal"
data-target=
"#
login
"
>
</div>
</div>
</wizard-step>
...
...
@@ -433,7 +433,7 @@
<div
class=
"modal"
id=
"quotes"
>
<div
class=
"modal-dialog modal-full"
>
<div
class=
"modal-content login_modal_wrapper"
>
<div
class=
"modal_close"
data-dismiss=
"modal"
>
<div
#
closeQuoteWizard
class=
"modal_close"
data-dismiss=
"modal"
>
×
</div>
<div
class=
"modal-body"
>
...
...
@@ -488,7 +488,11 @@
<h6>
{{mechanic.phone}}
</h6>
</ng-template>
<button
class=
"view_profile"
>
View Profile
</button>
<button
#
bookNow
class=
"book_now"
(
click
)="
scheduleNow
()"
>
Book now
</button>
<button
(
click
)="
scheduleNow
(
mechanic
.
mechanic_id
)"
[
ngClass
]="{'
book_now
'
:scheduleDateInit =
=
true
,
'
book_now_disabled
'
:scheduleDateInit =
=
false
}"
>
{{loginDetails ? 'Book now' : 'Login and Continue' }}
</button>
</div>
<div
class=
"clear"
></div>
</div>
...
...
src/app/home/index/index.component.scss
View file @
2e8a234a
...
...
@@ -896,6 +896,23 @@
outline
:
none
;
}
}
.book_now_disabled
{
border
:
1px
solid
#808080
;
color
:
#808080
;
background
:
transparent
;
margin
:
5px
;
padding-left
:
15px
;
padding-right
:
15px
;
border-radius
:
20px
;
height
:
35px
;
font-size
:
14px
;
&
:focus
{
outline
:
none
;
}
pointer-events
:
none
;
cursor
:
default
;
text-decoration
:
none
;
}
}
}
}
...
...
src/app/home/index/index.component.ts
View file @
2e8a234a
...
...
@@ -34,12 +34,13 @@ export class IndexComponent implements OnInit {
//Basic Location Search: TAB 1
autocomplete
:
any
;
searchLocError
:
boolean
;
@
ViewChild
(
"bookNow"
)
public
bookNowRef
:
ElementRef
;
@
ViewChild
(
"goTostep1"
)
public
goTostep1Ref
:
ElementRef
;
@
ViewChild
(
"closeWizard"
)
public
closeWizardRef
:
ElementRef
;
@
ViewChild
(
"step2nextBtn"
)
public
step2nextRef
:
ElementRef
;
@
ViewChild
(
"step3nextBtn"
)
public
step3nextRef
:
ElementRef
;
@
ViewChild
(
"googleLocSearch"
)
public
searchElementRef
:
ElementRef
;
@
ViewChild
(
"indexLoginModal"
)
loginModalRef
:
ElementRef
;
@
ViewChild
(
"closeQuoteWizard"
)
closeQuoteWizardRef
:
ElementRef
;
//Vehicle Details: TAB 2
vehicleDataForm
;
...
...
@@ -52,16 +53,18 @@ export class IndexComponent implements OnInit {
//Quote Page
today
:
any
=
new
Date
();
currDate
:
any
;
nextDate
:
any
;
dateStep
:
number
=
0
;
dateSection
:
any
[]
=
new
Array
();
imageServer
:
string
;
mechanicData
:
any
;
currDate
:
any
;
nextDate
:
any
;
autoSchedule
:
boolean
;
scheduleDateInit
:
boolean
;
carModel
:
any
;
carSearchJsonData
:
any
;
modelDates
:
number
[]
=
new
Array
();
carSearchJsonData
:
any
;
constructor
(
private
router
:
Router
,
...
...
@@ -69,12 +72,14 @@ export class IndexComponent implements OnInit {
public
webService
:
WebService
,
public
mapsAPILoader
:
MapsAPILoader
,
public
subjectService
:
SubjectService
)
{
this
.
autoSchedule
=
false
;
this
.
imageServer
=
ImageStorage
;
this
.
currDate
=
new
Date
();
this
.
nextDate
=
new
Date
();
this
.
loginDetails
=
false
;
this
.
searchLocError
=
false
;
this
.
scheduleDateInit
=
false
;
this
.
vehicleDataFormSubmit
=
false
;
this
.
currDate
=
new
Date
();
this
.
nextDate
=
new
Date
();
}
ngOnInit
()
{
...
...
@@ -97,6 +102,10 @@ export class IndexComponent implements OnInit {
this
.
subjectService
.
getLoginData
().
subscribe
(
loginData
=>
{
this
.
loginDetails
=
JSON
.
parse
(
this
.
webService
.
getLocalStorageItem
(
'userData'
));
if
(
this
.
loginDetails
&&
this
.
autoSchedule
){
this
.
confirmBooking
();
}
});
this
.
mapsAPILoader
.
load
().
then
(()
=>
{
...
...
@@ -287,6 +296,7 @@ export class IndexComponent implements OnInit {
}
getSchedule
(
time
,
index
){
this
.
scheduleDateInit
=
true
;
this
.
wizardData
[
'schedule_date'
]
=
{
'date'
:
this
.
formatDate
(
this
.
dateSection
[
index
]),
'time'
:
time
};
}
...
...
@@ -300,25 +310,32 @@ export class IndexComponent implements OnInit {
return
[
year
,
month
,
day
].
join
(
'-'
);
}
scheduleNow
(){
scheduleNow
(
mechanic_id
){
this
.
wizardData
[
'mechanic_id'
]
=
mechanic_id
;
if
(
!
this
.
loginDetails
){
this
.
autoSchedule
=
true
;
this
.
loginModalRef
.
nativeElement
.
click
();
return
false
;
}
this
.
loader
=
true
;
this
.
confirmBooking
();
}
confirmBooking
(){
this
.
wizardData
[
'customer_id'
]
=
this
.
loginDetails
.
customer_id
;
this
.
webService
.
post_data
(
'scheduleNow'
,
this
.
wizardData
).
subscribe
(
response
=>
{
this
.
loader
=
false
;
if
(
response
.
status
==
'1'
){
this
.
mechanicData
=
response
.
mechanic_data
;
this
.
dateSection
.
push
(
new
Date
(
this
.
today
.
setDate
(
this
.
today
.
getDate
())));
this
.
dateSection
.
push
(
new
Date
(
this
.
today
.
setDate
(
this
.
today
.
getDate
()
+
1
)));
this
.
closeWizardRef
.
nativeElement
.
click
();
this
.
closeQuoteWizardRef
.
nativeElement
.
click
();
this
.
router
.
navigate
([
'../dashboard'
]);
}
else
{
return
false
;
}
},
error
=>
{
this
.
loader
=
false
;
return
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