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
Jan 16, 2019
by
Tobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dc
parent
637f6a6b
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
121 additions
and
59 deletions
+121
-59
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
+22
-39
No files found.
application/controllers/Vehicle.php
View file @
a3a0b0a1
...
...
@@ -59,6 +59,9 @@ class Vehicle extends CI_Controller {
echo
json_encode
(
$return_arr
);
exit
;
}
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
[
'attributes'
][
'Model'
]
.
' '
.
$vehData
[
'attributes'
][
'Trim'
];
}
...
...
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
application/models/Customer_model.php
View file @
a3a0b0a1
...
...
@@ -38,6 +38,7 @@ class Customer_model extends CI_Model {
return
2
;
}
}
if
(
isset
(
$customer_data
[
'phone'
])
&&
!
empty
(
$customer_data
[
'phone'
])){
$phoneChk
=
$this
->
db
->
get_where
(
'customers'
,
array
(
'phone'
=>
$customer_data
[
'phone'
],
'status !='
=>
'2'
));
if
(
!
empty
(
$phoneChk
)
&&
$phoneChk
->
num_rows
()
>
0
){
...
...
@@ -99,7 +100,7 @@ class Customer_model extends CI_Model {
}
$result
=
$this
->
db
->
get_where
(
'customers'
,
array
(
'email'
=>
$userLogData
[
'email'
],
'password'
=>
md5
(
$userLogData
[
'password'
])
,
'password'
=>
$userLogData
[
'password'
]
,
'status'
=>
'1'
));
$respArr
[
'status'
]
=
3
;
if
(
!
empty
(
$result
)
&&
$result
->
num_rows
()
==
1
&&
!
empty
(
$custData
=
$result
->
row
())){
...
...
@@ -131,23 +132,5 @@ class Customer_model extends CI_Model {
}
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
application/models/Vehicle_model.php
View file @
a3a0b0a1
...
...
@@ -26,52 +26,34 @@ class Vehicle_model extends CI_Model {
return
$status
;
}
public
function
scheduleBooking
(
$post
Data
=
array
()){
if
(
empty
(
$post
Data
)){
function
getCustVechiles
(
$search
Data
=
array
()){
if
(
empty
(
$search
Data
)){
return
0
;
}
$vehData
=
$postData
[
'vechile_info'
];
$car_name
=
$vehData
[
'modelYear'
]
.
' '
.
$vehData
[
'maker'
]
.
' '
.
$vehData
[
'modelName'
];
$cond
=
array
();
$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'
);
$cond
[
'status'
]
=
1
;
if
(
isset
(
$searchData
[
'customer_id'
])
&&
!
empty
(
$searchData
[
'customer_id'
])){
$cond
[
'customer_id'
]
=
$searchData
[
'customer_id'
];
}
$vehData
=
$this
->
db
->
get_where
(
'customer_vehicle'
,
$cond
);
if
(
$this
->
db
->
insert
(
'bookings'
,
$book_d
ata
)){
return
1
;
if
(
!
empty
(
$vehD
ata
)){
return
$vehData
->
result
()
;
}
return
0
;
}
function
changeCustomerCarStatus
(
$customer_id
=
''
,
$customer_veh_id
=
''
,
$status
=
''
){
if
(
empty
(
$customer_id
)
||
empty
(
$customer_veh_id
)
||
$status
==
''
){
return
0
;
}
$upStatus
=
$this
->
db
->
update
(
'customer_vehicle'
,
array
(
'status'
=>
$status
),
array
(
'customer_id'
=>
$customer_id
,
'customer_veh_id'
=>
$customer_veh_id
));
return
$upStatus
;
}
}
?>
\ No newline at end of file
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