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
a3a0b0a1
Commit
a3a0b0a1
authored
6 years ago
by
Tobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dc
parent
637f6a6b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
124 additions
and
62 deletions
+124
-62
Vehicle.php
application/controllers/Vehicle.php
+3
-0
Webservices.php
application/controllers/Webservices.php
+0
-0
Booking_model.php
application/models/Booking_model.php
+94
-0
Customer_model.php
application/models/Customer_model.php
+2
-20
Vehicle_model.php
application/models/Vehicle_model.php
+25
-42
No files found.
application/controllers/Vehicle.php
View file @
a3a0b0a1
...
@@ -59,6 +59,9 @@ class Vehicle extends CI_Controller {
...
@@ -59,6 +59,9 @@ class Vehicle extends CI_Controller {
echo
json_encode
(
$return_arr
);
exit
;
echo
json_encode
(
$return_arr
);
exit
;
}
}
if
(
$searchType
==
2
){
if
(
$searchType
==
2
){
$vehicle_data
[
'car_model'
]
=
$vehData
[
'attributes'
][
'Model'
];
$vehicle_data
[
'car_maker'
]
=
$vehData
[
'attributes'
][
'Make'
];
$vehicle_data
[
'car_model_year'
]
=
$vehData
[
'attributes'
][
'Year'
];
$vehData
[
'vehicle'
]
=
$vehData
[
'attributes'
][
'Year'
]
.
' '
.
$vehData
[
'attributes'
][
'Make'
]
.
' '
.
$vehData
[
'vehicle'
]
=
$vehData
[
'attributes'
][
'Year'
]
.
' '
.
$vehData
[
'attributes'
][
'Make'
]
.
' '
.
$vehData
[
'attributes'
][
'Model'
]
.
' '
.
$vehData
[
'attributes'
][
'Trim'
];
$vehData
[
'attributes'
][
'Model'
]
.
' '
.
$vehData
[
'attributes'
][
'Trim'
];
}
}
...
...
This diff is collapsed.
Click to expand it.
application/controllers/Webservices.php
View file @
a3a0b0a1
This diff is collapsed.
Click to expand it.
application/models/Booking_model.php
0 → 100644
View file @
a3a0b0a1
<?php
class
Booking_model
extends
CI_Model
{
public
function
_consruct
(){
parent
::
_construct
();
}
public
function
scheduleBooking
(
$postData
=
array
()){
if
(
empty
(
$postData
)){
return
0
;
}
$vehData
=
$postData
[
'vechile_info'
];
$car_name
=
$vehData
[
'modelYear'
]
.
' '
.
$vehData
[
'maker'
]
.
' '
.
$vehData
[
'modelName'
];
$vehJson
=
array
(
'vehicle'
=>
$car_name
,
'attributes'
=>
array
(
'Year'
=>
$vehData
[
'modelYear'
],
'Make'
=>
$vehData
[
'maker'
],
'Trim'
=>
$vehData
[
'trim'
],
'Model'
=>
$vehData
[
'modelName'
],
'Engine'
=>
$vehData
[
'emgine'
]
));
$insert_array
=
array
(
'customer_id'
=>
$postData
[
'customer_id'
],
'car_name'
=>
$car_name
,
'car_model'
=>
$vehData
[
'modelName'
],
'car_maker'
=>
$vehData
[
'maker'
],
'car_loc_lat'
=>
$postData
[
'pickup_data'
][
'pickup_lat'
],
'car_loc_lng'
=>
$postData
[
'pickup_data'
][
'pickup_lng'
],
'car_location'
=>
$postData
[
'pickup_data'
][
'pickup_loc'
],
'vehicle_data'
=>
json_encode
(
$vehJson
),
'car_model_year'
=>
$vehData
[
'modelYear'
],
'status'
=>
'3'
);
if
(
$this
->
db
->
insert
(
'customer_vehicle'
,
$insert_array
)){
$last_id
=
$this
->
db
->
insert_id
();
$book_data
=
array
(
'customer_veh_id'
=>
$last_id
,
'customer_id'
=>
$postData
[
'customer_id'
],
'mechanic_id'
=>
$postData
[
'mechanic_id'
],
'scheduled_date'
=>
$postData
[
'schedule_date'
][
'date'
],
'scheduled_time'
=>
$postData
[
'schedule_date'
][
'time'
],
'mileage'
=>
$vehData
[
'milage'
],
'status'
=>
'0'
);
if
(
$this
->
db
->
insert
(
'bookings'
,
$book_data
)){
return
1
;
}
}
return
0
;
}
function
getCustBookDetails
(
$postData
=
array
(),
$status
=
''
){
$cond
=
array
();
if
(
empty
(
$postData
)
||
!
isset
(
$postData
[
'customer_id'
])
||
empty
(
$postData
[
'customer_id'
])){
return
0
;
}
$cond
=
"BK.customer_id='"
.
$postData
[
'customer_id'
]
.
"' "
;
$cond
.=
(
!
empty
(
$status
))
?
"AND BK.status IN ("
.
$status
.
") "
:
''
;
$sql
=
"SELECT BK.booking_id,BK.customer_id,BK.mechanic_id,BK.customer_veh_id,BK.scheduled_date,
BK.scheduled_time,BK.cost,BK.status,MECH.first_name,MECH.last_name,VEH.car_name,
BK.status
FROM bookings AS BK
INNER JOIN mechanic AS MECH ON (MECH.mechanic_id AND BK.mechanic_id)
INNER JOIN customer_vehicle AS VEH ON (VEH.customer_veh_id AND BK.customer_veh_id)
WHERE
$cond
GROUP BY BK.booking_id"
;
$bookData
=
$this
->
db
->
query
(
$sql
);
if
(
!
empty
(
$bookData
)){
return
$bookData
->
result
();
}
return
0
;
}
function
changeBookStatus
(
$customer_id
=
''
,
$booking_id
=
''
,
$status
=
''
){
if
(
empty
(
$customer_id
)
||
empty
(
$booking_id
)
||
$status
==
''
){
return
0
;
}
$status
=
$this
->
db
->
update
(
'bookings'
,
array
(
'status'
=>
$status
),
array
(
'customer_id'
=>
$customer_id
,
'booking_id'
=>
$booking_id
));
return
$status
;
}
}
?>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
application/models/Customer_model.php
View file @
a3a0b0a1
...
@@ -38,6 +38,7 @@ class Customer_model extends CI_Model {
...
@@ -38,6 +38,7 @@ class Customer_model extends CI_Model {
return
2
;
return
2
;
}
}
}
}
if
(
isset
(
$customer_data
[
'phone'
])
&&
!
empty
(
$customer_data
[
'phone'
])){
if
(
isset
(
$customer_data
[
'phone'
])
&&
!
empty
(
$customer_data
[
'phone'
])){
$phoneChk
=
$this
->
db
->
get_where
(
'customers'
,
array
(
'phone'
=>
$customer_data
[
'phone'
],
'status !='
=>
'2'
));
$phoneChk
=
$this
->
db
->
get_where
(
'customers'
,
array
(
'phone'
=>
$customer_data
[
'phone'
],
'status !='
=>
'2'
));
if
(
!
empty
(
$phoneChk
)
&&
$phoneChk
->
num_rows
()
>
0
){
if
(
!
empty
(
$phoneChk
)
&&
$phoneChk
->
num_rows
()
>
0
){
...
@@ -99,7 +100,7 @@ class Customer_model extends CI_Model {
...
@@ -99,7 +100,7 @@ class Customer_model extends CI_Model {
}
}
$result
=
$this
->
db
->
get_where
(
'customers'
,
array
(
'email'
=>
$userLogData
[
'email'
],
$result
=
$this
->
db
->
get_where
(
'customers'
,
array
(
'email'
=>
$userLogData
[
'email'
],
'password'
=>
md5
(
$userLogData
[
'password'
])
,
'password'
=>
$userLogData
[
'password'
]
,
'status'
=>
'1'
));
'status'
=>
'1'
));
$respArr
[
'status'
]
=
3
;
$respArr
[
'status'
]
=
3
;
if
(
!
empty
(
$result
)
&&
$result
->
num_rows
()
==
1
&&
!
empty
(
$custData
=
$result
->
row
())){
if
(
!
empty
(
$result
)
&&
$result
->
num_rows
()
==
1
&&
!
empty
(
$custData
=
$result
->
row
())){
...
@@ -131,23 +132,5 @@ class Customer_model extends CI_Model {
...
@@ -131,23 +132,5 @@ class Customer_model extends CI_Model {
}
}
return
$respArr
;
return
$respArr
;
}
}
function
customer_registration
(
$userData
=
array
()){
$respArr
=
array
(
'status'
=>
0
);
if
(
empty
(
$userData
)){
return
$respArr
;
}
$result
=
$this
->
db
->
get_where
(
'customers'
,
array
(
'email'
=>
$userData
[
'email'
],
'status'
=>
'1'
));
if
(
!
empty
(
$result
)
&&
$result
->
num_rows
()
>=
1
){
$respArr
[
'status'
]
=
2
;
return
$respArr
;
}
$userData
[
'password'
]
=
md5
(
$userData
[
'password'
]);
$status
=
$this
->
db
->
insert
(
'customers'
,
$userData
);
if
(
$status
){
$respArr
[
'status'
]
=
1
;
}
return
$respArr
;
}
}
}
?>
?>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
application/models/Vehicle_model.php
View file @
a3a0b0a1
...
@@ -26,52 +26,34 @@ class Vehicle_model extends CI_Model {
...
@@ -26,52 +26,34 @@ class Vehicle_model extends CI_Model {
return
$status
;
return
$status
;
}
}
public
function
scheduleBooking
(
$post
Data
=
array
()){
function
getCustVechiles
(
$search
Data
=
array
()){
if
(
empty
(
$post
Data
)){
if
(
empty
(
$search
Data
)){
return
0
;
return
0
;
}
}
$vehData
=
$postData
[
'vechile_info'
];
$cond
=
array
();
$car_name
=
$vehData
[
'modelYear'
]
.
' '
.
$vehData
[
'maker'
]
.
' '
.
$vehData
[
'modelName'
];
$cond
[
'status'
]
=
1
;
$vehJson
=
array
(
'vehicle'
=>
$car_name
,
if
(
isset
(
$searchData
[
'customer_id'
])
&&
!
empty
(
$searchData
[
'customer_id'
])){
'attributes'
=>
$cond
[
'customer_id'
]
=
$searchData
[
'customer_id'
];
array
(
}
'Year'
=>
$vehData
[
'modelYear'
],
$vehData
=
$this
->
db
->
get_where
(
'customer_vehicle'
,
$cond
);
'Make'
=>
$vehData
[
'maker'
],
'Trim'
=>
$vehData
[
'trim'
],
if
(
!
empty
(
$vehData
)){
'Model'
=>
$vehData
[
'modelName'
],
return
$vehData
->
result
();
'Engine'
=>
$vehData
[
'emgine'
]
}
));
return
0
;
}
$insert_array
=
array
(
'customer_id'
=>
$postData
[
'customer_id'
],
'car_name'
=>
$car_name
,
'car_model'
=>
$vehData
[
'modelName'
],
'car_maker'
=>
$vehData
[
'maker'
],
'car_loc_lat'
=>
$postData
[
'pickup_data'
][
'pickup_lat'
],
'car_loc_lng'
=>
$postData
[
'pickup_data'
][
'pickup_lng'
],
'car_location'
=>
$postData
[
'pickup_data'
][
'pickup_loc'
],
'vehicle_data'
=>
json_encode
(
$vehJson
),
'car_model_year'
=>
$vehData
[
'modelYear'
],
'status'
=>
'3'
);
if
(
$this
->
db
->
insert
(
'customer_vehicle'
,
$insert_array
)){
function
changeCustomerCarStatus
(
$customer_id
=
''
,
$customer_veh_id
=
''
,
$status
=
''
){
$last_id
=
$this
->
db
->
insert_id
();
if
(
empty
(
$customer_id
)
||
empty
(
$customer_veh_id
)
||
$status
==
''
){
return
0
;
}
$book_data
=
array
(
$upStatus
=
$this
->
db
->
update
(
'customer_vehicle'
,
'customer_veh_id'
=>
$last_id
,
array
(
'status'
=>
$status
),
'customer_id'
=>
$postData
[
'customer_id'
],
array
(
'customer_id'
=>
$customer_id
,
'customer_veh_id'
=>
$customer_veh_id
));
'mechanic_id'
=>
$postData
[
'mechanic_id'
],
'scheduled_date'
=>
$postData
[
'schedule_date'
][
'date'
],
'scheduled_time'
=>
$postData
[
'schedule_date'
][
'time'
],
'mileage'
=>
$vehData
[
'milage'
],
'status'
=>
'0'
);
if
(
$this
->
db
->
insert
(
'bookings'
,
$book_data
)){
return
$upStatus
;
return
1
;
}
}
return
0
;
}
}
}
}
?>
?>
\ No newline at end of file
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