Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dcarfixers
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
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
Commits
56c0da32
Commit
56c0da32
authored
Apr 05, 2019
by
Jansa Jose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservice for service provider and mechanic data in admin panel
parent
31deb365
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
5 deletions
+109
-5
Bookings.php
application/controllers/Bookings.php
+4
-2
Webservices.php
application/controllers/Webservices.php
+54
-0
Webservice_model.php
application/models/Webservice_model.php
+48
-0
list-booking.php
application/views/Bookings/list-booking.php
+3
-3
No files found.
application/controllers/Bookings.php
View file @
56c0da32
...
@@ -37,7 +37,7 @@ class Bookings extends CI_Controller {
...
@@ -37,7 +37,7 @@ class Bookings extends CI_Controller {
$template
[
'smenu'
]
=
"View Bookings"
;
$template
[
'smenu'
]
=
"View Bookings"
;
$template
[
'mechanic_id'
]
=
(
$this
->
session
->
userdata
(
'user_type'
)
==
1
&&
$template
[
'mechanic_id'
]
=
(
$this
->
session
->
userdata
(
'user_type'
)
==
1
&&
empty
(
$mechanic_id
))
?
'
1
'
:
$mechanic_id
;
empty
(
$mechanic_id
))
?
''
:
$mechanic_id
;
$template
[
'mechanic_data'
]
=
$mechanic_data
;
$template
[
'mechanic_data'
]
=
$mechanic_data
;
$template
[
'bookingData'
]
=
$this
->
Booking_model
->
getMechBookings
(
$mechanic_id
,
''
,
'0,1,3,4'
);
$template
[
'bookingData'
]
=
$this
->
Booking_model
->
getMechBookings
(
$mechanic_id
,
''
,
'0,1,3,4'
);
$this
->
load
->
view
(
'template'
,
$template
);
$this
->
load
->
view
(
'template'
,
$template
);
...
@@ -45,9 +45,11 @@ class Bookings extends CI_Controller {
...
@@ -45,9 +45,11 @@ class Bookings extends CI_Controller {
public
function
changeBookingStatus
(
$booking_id
=
''
,
$status
=
''
,
$mechanic_id
=
''
){
public
function
changeBookingStatus
(
$booking_id
=
''
,
$status
=
''
,
$mechanic_id
=
''
){
$flashMsg
=
array
(
'message'
=>
'Something went wrong, please try again..!'
,
'class'
=>
'error'
);
$flashMsg
=
array
(
'message'
=>
'Something went wrong, please try again..!'
,
'class'
=>
'error'
);
$mechanic_id
=
(
$this
->
session
->
userdata
(
'user_type'
)
==
1
&&
!
empty
(
$mechanic_id
))
?
$mechanic_id
:
''
;
if
(
empty
(
$booking_id
)
||
$status
==
''
){
if
(
empty
(
$booking_id
)
||
$status
==
''
){
$this
->
session
->
set_flashdata
(
'message'
,
$flashMsg
);
$this
->
session
->
set_flashdata
(
'message'
,
$flashMsg
);
redirect
(
base_url
(
'Bookings/listBookings
'
));
redirect
(
base_url
(
'Bookings/listBookings
/'
.
$mechanic_id
));
}
}
$booking_id
=
decode_param
(
$booking_id
);
$booking_id
=
decode_param
(
$booking_id
);
...
...
application/controllers/Webservices.php
View file @
56c0da32
...
@@ -185,6 +185,60 @@
...
@@ -185,6 +185,60 @@
echo
json_encode
(
$respArr
);
exit
;
echo
json_encode
(
$respArr
);
exit
;
}
}
// customer_registration
public
function
service_provider_registration
(){
header
(
'Content-type: application/json'
);
$post
=
file_get_contents
(
"php://input"
);
$postData
=
json_decode
(
$post
,
true
);
$respArr
=
array
(
'status'
=>
'0'
,
'message'
=>
'Something went wrong.'
);
if
(
empty
(
$postData
)){
echo
json_encode
(
$respArr
);
exit
;
}
$err
=
0
;
$msg
=
''
;
if
(
!
isset
(
$postData
[
'email'
])
||
empty
(
$postData
[
'email'
])){
$err
=
1
;
$msg
=
'Provide a valid Email ID'
;
}
else
if
(
!
isset
(
$postData
[
'password'
])
||
empty
(
$postData
[
'password'
]
=
md5
(
$postData
[
'password'
]))){
$err
=
1
;
$msg
=
'Provide a Password'
;
}
else
if
(
!
isset
(
$postData
[
'first_name'
])
||
empty
(
$postData
[
'first_name'
])){
$err
=
1
;
$msg
=
'Provide valid Name'
;
}
else
if
(
!
isset
(
$postData
[
'last_name'
])
||
empty
(
$postData
[
'last_name'
])){
$err
=
1
;
$msg
=
'Provide valid Name'
;
}
else
if
(
!
isset
(
$postData
[
'phone'
])
||
empty
(
$postData
[
'phone'
])){
$err
=
1
;
$msg
=
'Provide valid Phone Number'
;
}
if
(
$err
==
1
){
$respArr
[
'message'
]
=
$msg
;
echo
json_encode
(
$respArr
);
exit
;
}
$custResp
=
$this
->
Webservice_model
->
createServiceProvider
(
$postData
);
if
(
$custResp
==
'0'
){
$respArr
[
'message'
]
=
'Something went wrong.'
;
}
else
if
(
$custResp
==
'1'
){
$respArr
[
'status'
]
=
'1'
;
$respArr
[
'message'
]
=
'Success'
;
}
else
if
(
$custResp
==
'2'
){
$respArr
[
'message'
]
=
'Email Address already in use'
;
}
else
if
(
$custResp
==
'3'
){
$respArr
[
'message'
]
=
'Phone already in use'
;
}
echo
json_encode
(
$respArr
);
exit
;
}
// getGeneralIssues
// getGeneralIssues
public
function
getGeneralIssues
(){
public
function
getGeneralIssues
(){
...
...
application/models/Webservice_model.php
View file @
56c0da32
...
@@ -47,6 +47,54 @@ class Webservice_model extends CI_Model {
...
@@ -47,6 +47,54 @@ class Webservice_model extends CI_Model {
return
$respArr
;
return
$respArr
;
}
}
function
createServiceProvider
(
$provider_data
=
array
()){
if
(
empty
(
$provider_data
))
return
0
;
if
(
isset
(
$provider_data
[
'email'
])
&&
!
empty
(
$provider_data
[
'email'
])){
$emailChk
=
$this
->
db
->
get_where
(
'admin_users'
,
array
(
'username'
=>
$provider_data
[
'email'
],
'status !='
=>
'2'
));
if
(
!
empty
(
$emailChk
)
&&
$emailChk
->
num_rows
()
>
0
){
return
2
;
}
}
if
(
isset
(
$provider_data
[
'phone'
])
&&
!
empty
(
$provider_data
[
'phone'
])){
$phoneChk
=
$this
->
db
->
get_where
(
'mechanic'
,
array
(
'phone'
=>
$provider_data
[
'phone'
]));
if
(
!
empty
(
$phoneChk
)
&&
$phoneChk
->
num_rows
()
>
0
){
return
3
;
}
}
$status
=
$this
->
db
->
insert
(
'admin_users'
,
array
(
'username'
=>
$provider_data
[
'email'
],
'password'
=>
md5
(
$provider_data
[
'password'
]),
'display_name'
=>
$provider_data
[
'first_name'
]
.
' '
.
$provider_data
[
'last_name'
],
'user_type'
=>
'2'
,
'status'
=>
'1'
));
if
(
!
$status
){
return
0
;
}
$mechanic_id
=
$this
->
db
->
insert_id
();
$status
=
$this
->
db
->
insert
(
'mechanic'
,
array
(
'mechanic_id'
=>
$mechanic_id
,
'city'
=>
''
,
'phone'
=>
$provider_data
[
'phone'
],
'state'
=>
''
,
'shop_id'
=>
''
,
'address'
=>
''
,
'licence'
=>
''
,
'location'
=>
''
,
'email_id'
=>
$provider_data
[
'email'
],
'end_time'
=>
''
,
'last_name'
=>
$provider_data
[
'last_name'
],
'start_time'
=>
''
,
'first_name'
=>
$provider_data
[
'first_name'
],
'location_lat'
=>
''
,
'location_lng'
=>
''
,
'licence_number'
=>
''
,
'licence_exp_date'
=>
''
));
return
(
$status
)
?
1
:
0
;
}
public
function
insert_auth
(
$id
){
public
function
insert_auth
(
$id
){
$static_string
=
time
();
$static_string
=
time
();
$authToken
=
'Dcarfixs'
.
sha1
(
$static_string
);
$authToken
=
'Dcarfixs'
.
sha1
(
$static_string
);
...
...
application/views/Bookings/list-booking.php
View file @
56c0da32
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
</div>
</div>
</div>
</div>
<?php
}
<?php
}
if
(
$this
->
session
->
userdata
[
'user_type'
]
!=
1
||
(
$this
->
session
->
userdata
[
'user_type'
]
==
1
&&
!
empty
(
$mechanic_id
)
)){
?>
if
(
$this
->
session
->
userdata
[
'user_type'
]
!=
1
||
(
$this
->
session
->
userdata
[
'user_type'
]
==
1
)){
?>
<div
class=
"col-xs-12"
>
<div
class=
"col-xs-12"
>
<div
class=
"box box-warning"
>
<div
class=
"box box-warning"
>
<div
class=
"box-body"
>
<div
class=
"box-body"
>
...
@@ -105,11 +105,11 @@
...
@@ -105,11 +105,11 @@
<i
class=
"fa fa-fw fa-edit"
></i>
View Quote
<i
class=
"fa fa-fw fa-edit"
></i>
View Quote
</button>
</button>
<?php
if
(
$bookData
->
status
==
1
){
?>
<?php
if
(
$bookData
->
status
==
1
){
?>
<a
class=
"btn btn-sm btn-success"
style=
"background-color:#ac2925"
href=
"
<?=
base_url
(
"Bookings/changeBookingStatus/"
.
encode_param
(
$bookData
->
booking_id
)
.
"/
3
/"
.
encode_param
(
$mechanic_id
))
?>
"
>
<a
class=
"btn btn-sm btn-success"
style=
"background-color:#ac2925"
href=
"
<?=
base_url
(
"Bookings/changeBookingStatus/"
.
encode_param
(
$bookData
->
booking_id
)
.
"/
4
/"
.
encode_param
(
$mechanic_id
))
?>
"
>
<i
class=
"fa fa-cog"
></i>
Cancel
<i
class=
"fa fa-cog"
></i>
Cancel
</a>
</a>
<?php
}
?>
<?php
}
?>
<?php
if
(
$bookData
->
status
==
0
||
$bookData
->
status
==
3
){
?>
<?php
if
(
$bookData
->
status
==
0
||
$bookData
->
status
==
4
){
?>
<a
class=
"btn btn-sm btn-success"
href=
"
<?=
base_url
(
"Bookings/changeBookingStatus/"
.
encode_param
(
$bookData
->
booking_id
)
.
"/1/"
.
encode_param
(
$mechanic_id
))
?>
"
>
<a
class=
"btn btn-sm btn-success"
href=
"
<?=
base_url
(
"Bookings/changeBookingStatus/"
.
encode_param
(
$bookData
->
booking_id
)
.
"/1/"
.
encode_param
(
$mechanic_id
))
?>
"
>
<i
class=
"fa fa-cog"
></i>
Accept
<i
class=
"fa fa-cog"
></i>
Accept
</a>
</a>
...
...
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