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
ac54303a
Commit
ac54303a
authored
Jan 17, 2019
by
Tobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dc
parent
a3a0b0a1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
15 deletions
+56
-15
Webservices.php
application/controllers/Webservices.php
+2
-2
Booking_model.php
application/models/Booking_model.php
+19
-9
Mechanic_model.php
application/models/Mechanic_model.php
+35
-4
tobin_dcarfixers.sql
sql/tobin_dcarfixers.sql
+0
-0
No files found.
application/controllers/Webservices.php
View file @
ac54303a
...
@@ -212,7 +212,7 @@ class Webservices extends CI_Controller {
...
@@ -212,7 +212,7 @@ class Webservices extends CI_Controller {
$this
->
load
->
model
(
'Mechanic_model'
);
$this
->
load
->
model
(
'Mechanic_model'
);
$respArr
=
array
(
'status'
=>
'0'
,
'message'
=>
'Something went wrong.'
);
$respArr
=
array
(
'status'
=>
'0'
,
'message'
=>
'Something went wrong.'
);
pr
(
$postData
);
if
(
empty
(
$postData
)
||
!
isset
(
$postData
[
'pickup_data'
])
||
!
isset
(
$postData
[
'sub_issues'
])
||
if
(
empty
(
$postData
)
||
!
isset
(
$postData
[
'pickup_data'
])
||
!
isset
(
$postData
[
'sub_issues'
])
||
empty
(
$postData
[
'pickup_data'
])
||
empty
(
$postData
[
'sub_issues'
])
){
empty
(
$postData
[
'pickup_data'
])
||
empty
(
$postData
[
'sub_issues'
])
){
echo
json_encode
(
$respArr
);
exit
;
echo
json_encode
(
$respArr
);
exit
;
...
@@ -320,7 +320,7 @@ class Webservices extends CI_Controller {
...
@@ -320,7 +320,7 @@ class Webservices extends CI_Controller {
if
(
$custResp
==
'1'
){
if
(
$custResp
==
'1'
){
$respArr
[
'status'
]
=
'1'
;
$respArr
[
'status'
]
=
'1'
;
$respArr
[
'message'
]
=
'Profile successfully updated'
;
$respArr
[
'message'
]
=
'Profile successfully updated'
;
$respArr
[
'profile_image'
]
=
$postData
[
'profile_image'
]
;
$respArr
[
'profile_image'
]
=
(
isset
(
$postData
[
'profile_image'
])
&&
!
empty
(
$postData
[
'profile_image'
]))
?
$postData
[
'profile_image'
]
:
''
;
echo
json_encode
(
$respArr
);
exit
;
echo
json_encode
(
$respArr
);
exit
;
}
else
if
(
$custResp
==
'2'
){
}
else
if
(
$custResp
==
'2'
){
$respArr
[
'status'
]
=
'2'
;
$respArr
[
'status'
]
=
'2'
;
...
...
application/models/Booking_model.php
View file @
ac54303a
...
@@ -6,7 +6,12 @@ class Booking_model extends CI_Model {
...
@@ -6,7 +6,12 @@ class Booking_model extends CI_Model {
}
}
public
function
scheduleBooking
(
$postData
=
array
()){
public
function
scheduleBooking
(
$postData
=
array
()){
if
(
empty
(
$postData
)){
if
(
empty
(
$postData
)
||
!
isset
(
$postData
[
'customer_id'
])
||
empty
(
$postData
[
'customer_id'
])
||
!
isset
(
$postData
[
'pickup_data'
])
||
empty
(
$postData
[
'pickup_data'
])
||
!
isset
(
$postData
[
'vechile_info'
])
||
empty
(
$postData
[
'vechile_info'
])
||
!
isset
(
$postData
[
'mechanic_id'
])
||
empty
(
$postData
[
'mechanic_id'
])
||
!
isset
(
$postData
[
'selected_issues'
])
||
empty
(
$postData
[
'selected_issues'
])){
return
0
;
return
0
;
}
}
$vehData
=
$postData
[
'vechile_info'
];
$vehData
=
$postData
[
'vechile_info'
];
...
@@ -14,16 +19,13 @@ class Booking_model extends CI_Model {
...
@@ -14,16 +19,13 @@ class Booking_model extends CI_Model {
$vehJson
=
array
(
'vehicle'
=>
$car_name
,
$vehJson
=
array
(
'vehicle'
=>
$car_name
,
'attributes'
=>
'attributes'
=>
array
(
array
(
'Year'
=>
$vehData
[
'modelYear'
],
'Year'
=>
$vehData
[
'modelYear'
],
'Make'
=>
$vehData
[
'maker'
],
'Make'
=>
$vehData
[
'maker'
],
'Trim'
=>
$vehData
[
'trim'
],
'Trim'
=>
$vehData
[
'trim'
],
'Model'
=>
$vehData
[
'modelName'
],
'Model'
=>
$vehData
[
'modelName'
],
'Engine'
=>
$vehData
[
'emgine'
]
'Engine'
=>
$vehData
[
'emgine'
]));
));
$insert_array
=
array
(
$insert_array
=
array
(
'customer_id'
=>
$postData
[
'customer_id'
],
'customer_id'
=>
$postData
[
'customer_id'
],
'car_name'
=>
$car_name
,
'car_name'
=>
$car_name
,
'car_model'
=>
$vehData
[
'modelName'
],
'car_model'
=>
$vehData
[
'modelName'
],
'car_maker'
=>
$vehData
[
'maker'
],
'car_maker'
=>
$vehData
[
'maker'
],
...
@@ -34,15 +36,23 @@ class Booking_model extends CI_Model {
...
@@ -34,15 +36,23 @@ class Booking_model extends CI_Model {
'car_model_year'
=>
$vehData
[
'modelYear'
],
'car_model_year'
=>
$vehData
[
'modelYear'
],
'status'
=>
'3'
);
'status'
=>
'3'
);
$selected_issues
=
array
();
foreach
(
$postData
[
'selected_issues'
]
AS
$selIssue
){
$selected_issues
[]
=
array
(
'issue'
=>
$selIssue
[
'issue'
],
'issue_id'
=>
$selIssue
[
'issue_id'
],
'sub_issue_id'
=>
$selIssue
[
'sub_issue_id'
],
'issue_category'
=>
$selIssue
[
'issue_category'
]);
}
if
(
$this
->
db
->
insert
(
'customer_vehicle'
,
$insert_array
)){
if
(
$this
->
db
->
insert
(
'customer_vehicle'
,
$insert_array
)){
$last_id
=
$this
->
db
->
insert_id
();
$last_id
=
$this
->
db
->
insert_id
();
$book_data
=
array
(
$book_data
=
array
(
'customer_veh_id'
=>
$last_id
,
'customer_veh_id'
=>
$last_id
,
'customer_id'
=>
$postData
[
'customer_id'
],
'customer_id'
=>
$postData
[
'customer_id'
],
'mechanic_id'
=>
$postData
[
'mechanic_id'
],
'mechanic_id'
=>
$postData
[
'mechanic_id'
],
'scheduled_date'
=>
$postData
[
'schedule_date'
][
'date'
],
'scheduled_date'
=>
$postData
[
'schedule_date'
][
'date'
],
'scheduled_time'
=>
$postData
[
'schedule_date'
][
'time'
],
'scheduled_time'
=>
$postData
[
'schedule_date'
][
'time'
],
'issues_selected'
=>
json_encode
(
$selected_issues
),
'mileage'
=>
$vehData
[
'milage'
],
'mileage'
=>
$vehData
[
'milage'
],
'status'
=>
'0'
);
'status'
=>
'0'
);
...
...
application/models/Mechanic_model.php
View file @
ac54303a
...
@@ -133,13 +133,14 @@ class Mechanic_model extends CI_Model {
...
@@ -133,13 +133,14 @@ class Mechanic_model extends CI_Model {
return
$status
;
return
$status
;
}
}
function
getNearByMechanics
(
$
pickLocData
=
array
()){
function
getNearByMechanics
(
$
location_data
=
array
(),
$sub_issues
=
array
()){
if
(
empty
(
$
pickLocData
)){
if
(
empty
(
$
location_data
)
||
empty
(
$sub_issues
)){
return
0
;
return
0
;
}
}
$current_lat
=
$pickLocData
[
'pickup_lat'
];
$current_lat
=
$location_data
[
'pickup_lat'
];
$current_lng
=
$pickLocData
[
'pickup_lng'
];
$current_lng
=
$location_data
[
'pickup_lng'
];
$issue_cat_id
=
implode
(
','
,
$sub_issues
);
$sql
=
"SELECT AU.display_name,AU.profile_image,ME.*,MS.shop_name,MS.address AS shop_address,
$sql
=
"SELECT AU.display_name,AU.profile_image,ME.*,MS.shop_name,MS.address AS shop_address,
MS.phone AS shop_phone,MS.email_id AS shop_email_id,
MS.phone AS shop_phone,MS.email_id AS shop_email_id,
...
@@ -157,6 +158,7 @@ class Mechanic_model extends CI_Model {
...
@@ -157,6 +158,7 @@ class Mechanic_model extends CI_Model {
return
0
;
return
0
;
}
}
$estimate
=
0
;
$mechDataArr
=
array
();
$mechDataArr
=
array
();
foreach
(
$mechData
AS
$index
=>
$data
){
foreach
(
$mechData
AS
$index
=>
$data
){
if
(
empty
(
$data
[
'start_time'
])
||
empty
(
$data
[
'end_time'
])){
if
(
empty
(
$data
[
'start_time'
])
||
empty
(
$data
[
'end_time'
])){
...
@@ -171,6 +173,35 @@ class Mechanic_model extends CI_Model {
...
@@ -171,6 +173,35 @@ class Mechanic_model extends CI_Model {
$scheduleTiming
[]
=
date
(
'h:i A'
,
$schTime
);
$scheduleTiming
[]
=
date
(
'h:i A'
,
$schTime
);
}
}
}
}
$mechanic_id
=
$data
[
'mechanic_id'
];
$sql
=
"SELECT ISS.*, IC.*, MI.*
FROM issues_category AS IC
INNER JOIN issues AS ISS ON (IC.issue_id=ISS.issue_id)
LEFT JOIN mechanic_issues AS MI ON (MI.issue_cat_id=IC.issue_cat_id AND
MI.mechanic_id='
$mechanic_id
' AND MI.status='1')
WHERE ISS.status='1' AND IC.status='1' AND IC.issue_cat_id IN (
$issue_cat_id
)"
;
$subIssData
=
$this
->
db
->
query
(
$sql
);
$sIssueData
=
array
();
if
(
!
empty
(
$subIssData
)
&&
!
empty
(
$subIssData
=
$subIssData
->
result_array
())){
$sIssueData
=
$subIssData
;
}
$estimate
=
0
;
foreach
(
$sIssueData
AS
$sIndex
=>
$sIssue
){
if
(
!
empty
(
$sIssue
[
'custom_service_fee'
])){
$estimate
+=
$sIssue
[
'custom_service_fee'
];
$sIssueData
[
$sIndex
][
'service_fee'
]
=
$sIssue
[
'custom_service_fee'
];
}
else
{
$estimate
+=
$sIssue
[
'default_service_fee'
];
$sIssueData
[
$sIndex
][
'service_fee'
]
=
$sIssue
[
'default_service_fee'
];
}
}
$mechData
[
$index
][
'estimate'
]
=
$estimate
;
$mechData
[
$index
][
'sub_issues'
]
=
$sIssueData
;
$mechData
[
$index
][
'scheduleTiming'
]
=
$scheduleTiming
;
$mechData
[
$index
][
'scheduleTiming'
]
=
$scheduleTiming
;
}
}
return
$mechData
;
return
$mechData
;
...
...
sql/tobin_dcarfixers.sql
View file @
ac54303a
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