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
36c641a9
Commit
36c641a9
authored
Apr 16, 2019
by
Jansa Jose
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'jansa' into 'master'
dc- admin panel booking responses See merge request
!39
parents
56c0da32
7c783121
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
256 additions
and
58 deletions
+256
-58
Bookings.php
application/controllers/Bookings.php
+1
-0
Webservices.php
application/controllers/Webservices.php
+14
-3
Booking_model.php
application/models/Booking_model.php
+166
-36
Mechanic_model.php
application/models/Mechanic_model.php
+1
-1
Webservice_model.php
application/models/Webservice_model.php
+21
-0
list-booking.php
application/views/Bookings/list-booking.php
+30
-10
footer-script.php
application/views/Templates/footer-script.php
+1
-1
custom-script.js
assets/js/custom-script.js
+22
-7
No files found.
application/controllers/Bookings.php
View file @
36c641a9
...
...
@@ -40,6 +40,7 @@ class Bookings extends CI_Controller {
empty
(
$mechanic_id
))
?
''
:
$mechanic_id
;
$template
[
'mechanic_data'
]
=
$mechanic_data
;
$template
[
'bookingData'
]
=
$this
->
Booking_model
->
getMechBookings
(
$mechanic_id
,
''
,
'0,1,3,4'
);
//pr($template['bookingData']);
$this
->
load
->
view
(
'template'
,
$template
);
}
...
...
application/controllers/Webservices.php
View file @
36c641a9
...
...
@@ -285,9 +285,9 @@
header
(
'Content-type: application/json'
);
$postData
=
$_POST
;
$optionalData
=
array
(
'optionlaDescription'
=>
''
,
'optionalImages'
=>
array
(),
'optionalVideos'
=>
array
());
$optionalData
=
array
(
'optionlaDescription'
=>
''
,
'optionalImages'
=>
array
(),
'optionalVideos'
=>
array
());
$respArr
=
array
(
'status'
=>
'0'
,
'message'
=>
'Something went wrong.'
);
//pr(json_decode($postData['data']));
if
(
empty
(
$postData
)
||
empty
(
$postData
=
json_decode
(
$postData
[
'data'
],
true
))
||
!
isset
(
$postData
[
'cost'
])
||
empty
(
$postData
[
'cost'
])
||
!
isset
(
$postData
[
'customer_id'
])
||
empty
(
$postData
[
'customer_id'
])
||
...
...
@@ -472,7 +472,7 @@
echo
json_encode
(
$respArr
);
exit
;
}
$status
=
$this
->
Booking_model
->
changeBookStatus
(
$postData
[
'customer_id'
],
$postData
[
'booking_id'
],
'
3
'
);
$status
=
$this
->
Booking_model
->
changeBookStatus
(
$postData
[
'customer_id'
],
$postData
[
'booking_id'
],
'
4
'
);
if
(
$status
){
$respArr
[
'status'
]
=
1
;
...
...
@@ -1343,6 +1343,17 @@
$result
=
$this
->
Webservice_model
->
rate_mechanic
(
$postData
);
echo
json_encode
(
$result
);
exit
;
}
public
function
acceptMechanicQuote
(){
header
(
'Content-type:application/json'
);
$headers
=
apache_request_headers
();
$post
=
file_get_contents
(
"php://input"
);
$postData
=
json_decode
(
$post
,
true
);
$result
=
$this
->
Webservice_model
->
acceptMechanicQuote
(
$postData
);
echo
json_encode
(
$result
);
exit
;
}
}
?>
application/models/Booking_model.php
View file @
36c641a9
...
...
@@ -17,17 +17,31 @@ class Booking_model extends CI_Model {
$vehData
=
$postData
[
'vechile_info'
];
$car_name
=
$vehData
[
'modelYear'
]
.
' '
.
$vehData
[
'maker'
]
.
' '
.
$vehData
[
'modelName'
];
$vehJson
=
array
(
'vehicle'
=>
$car_name
,
'attributes'
=>
array
(
'Year'
=>
$vehData
[
'modelYear'
],
$vehJson
=
array
(
'vehicle'
=>
$car_name
,
'attributes'
=>
array
(
'Year'
=>
$vehData
[
'modelYear'
],
'Make'
=>
$vehData
[
'maker'
],
'Trim'
=>
$vehData
[
'trim'
],
'Model'
=>
$vehData
[
'modelName'
],
'Engine'
=>
$vehData
[
'emgine'
]));
'Engine'
=>
$vehData
[
'emgine'
]
)
);
$last_date
=
''
;
if
(
isset
(
$vehData
[
'lastMaintanceDate'
])
&&
!
empty
(
$vehData
[
'lastMaintanceDate'
])){
$last_date
=
$vehData
[
'lastMaintanceDate'
];
}
else
{
$last_date
=
''
;
}
$last_maintanence_date
=
''
;
if
(
isset
(
$vehData
[
'maintanenceInterval'
])
&&
!
empty
(
$vehData
[
'maintanenceInterval'
])){
$last_maintanence_date
=
$vehData
[
'maintanenceInterval'
];
}
$last_id
=
''
;
if
(
isset
(
$postData
[
'customer_vehicle_id'
])
&&
!
empty
(
$postData
[
'customer_vehicle_id'
])){
$last_id
=
$postData
[
'customer_vehicle_id'
];
$this
->
db
->
update
(
'customer_vehicle'
,
array
(
'last_maintenance_date'
=>
$last_date
,
'maintanence_interval'
=>
$last_maintanence_date
),
array
(
'customer_veh_id'
=>
$postData
[
'customer_vehicle_id'
]));
}
$insert_array
=
array
(
'customer_id'
=>
$postData
[
'customer_id'
],
'car_name'
=>
$car_name
,
'car_model'
=>
$vehData
[
'modelName'
],
...
...
@@ -36,8 +50,9 @@ class Booking_model extends CI_Model {
'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'
],
'last_maintenance_date'
=>
$last_date
,
'car_model_year'
=>
$vehData
[
'modelYear'
],
'last_maintenance_date'
=>
$last_date
,
'maintanence_interval'
=>
(
int
)
$last_maintanence_date
,
'status'
=>
'3'
);
$selected_issues
=
array
();
...
...
@@ -47,52 +62,102 @@ class Booking_model extends CI_Model {
'sub_issue_id'
=>
$selIssue
[
'sub_issue_id'
],
'issue_category'
=>
$selIssue
[
'issue_category'
]);
}
if
(
$this
->
db
->
insert
(
'customer_vehicle'
,
$insert_array
)){
if
(
empty
(
$last_id
)){
$this
->
db
->
insert
(
'customer_vehicle'
,
$insert_array
);
$last_id
=
$this
->
db
->
insert_id
();
}
$book_data
=
array
(
'cost'
=>
$postData
[
'cost'
],
'mileage'
=>
$vehData
[
'milage'
],
'customer_id'
=>
$postData
[
'customer_id'
],
'mechanic_id'
=>
$postData
[
'mechanic_id'
],
//
'mechanic_id' => $postData['mechanic_id'],
'scheduled_date'
=>
$postData
[
'schedule_date'
][
'date'
],
'scheduled_time'
=>
$postData
[
'schedule_date'
][
'time'
],
'issues_selected'
=>
json_encode
(
$selected_issues
),
'customer_veh_id'
=>
$last_id
,
'custom_issue_data'
=>
json_encode
(
$postData
[
'optionalData'
]),
'car_loc_lat'
=>
$postData
[
'pickup_data'
][
'pickup_lat'
],
'car_loc_lng'
=>
$postData
[
'pickup_data'
][
'pickup_lng'
],
'car_location'
=>
$postData
[
'pickup_data'
][
'pickup_loc'
],
'is_multiple'
=>
(
isset
(
$postData
[
'multiple'
]))
?
$postData
[
'multiple'
]
:
0
,
'status'
=>
'0'
);
if
(
$this
->
db
->
insert
(
'bookings'
,
$book_data
)){
return
1
;
$insertBookMech
=
array
();
$book_id
=
$this
->
db
->
insert_id
();
$mechanic_id
=
explode
(
','
,
$postData
[
'mechanic_id'
]);
foreach
(
$mechanic_id
AS
$mech_id
)
{
$insertBookMech
[]
=
array
(
'booking_id'
=>
$book_id
,
'mechanic_id'
=>
$mech_id
,
'status'
=>
'0'
);
}
if
(
!
empty
(
$insertBookMech
)){
$this
->
db
->
insert_batch
(
'mechanic_booking'
,
$insertBookMech
);
}
return
1
;
}
return
0
;
}
function
getCustBookDetails
(
$postData
=
array
(),
$status
=
''
){
$cond
=
array
();
$where_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
$sql
=
"SELECT BK.booking_id,BK.customer
_id,BK.customer_veh_id,BK.scheduled_date,
BK.scheduled_time,BK.cost,BK.is_multiple,BK.status,VEH.car_name,VEH.car_maker
,
VEH.car_model,VEH.car_model_year,
BK.status
FROM bookings AS BK
INNER JOIN mechanic AS MECH ON (MECH.mechanic_id = BK.mechanic_id)
INNER JOIN customer_vehicle AS VEH ON (VEH.customer_veh_id = BK.customer_veh_id)
WHERE
$cond
GROUP BY BK.booking_id"
;
$bookData
=
$this
->
db
->
query
(
$sql
);
if
(
empty
(
$bookData
)){
return
0
;
}
if
(
!
empty
(
$bookData
)){
return
$bookData
->
result
();
$bookDetails
=
array
();
$bookData
=
$bookData
->
result
();
foreach
(
$bookData
AS
$book
)
{
$bookMechData
=
$this
->
db
->
query
(
"SELECT * FROM mechanic_booking
WHERE booking_id='
$book->booking_id
' AND status!='2'"
);
if
(
!
empty
(
$bookMechData
)){
$bookMechData
=
$bookMechData
->
result
();
foreach
(
$bookMechData
AS
$mech_value
)
{
$mechanic_data
=
$this
->
db
->
query
(
"
SELECT ROUND(AVG(MR.rate),2) AS rating,MCH.mechanic_id,MCH.first_name,
MCH.last_name,MCH.phone,CQ.custom_service_quote,MCH.location,
MCH.email_id,CQ.custom_amount,BK.status
FROM mechanic_booking AS BK
INNER JOIN mechanic MCH ON BK.mechanic_id=MCH.mechanic_id
INNER JOIN admin_users AU ON AU.id=MCH.mechanic_id
LEFT JOIN custom_quote CQ ON
CQ.mechanic_id=BK.mechanic_id AND
CQ.booking_id=BK.booking_id AND CQ.status='1'
LEFT JOIN mechanic_rating MR ON
MR.mechanic_id=BK.mechanic_id AND MR.status='1'
WHERE AU.status='1' AND BK.mechanic_id='
$mech_value->mechanic_id
' AND
BK.booking_id='
$book->booking_id
'"
);
if
(
!
empty
(
$mechanic_data
)){
$mechData
=
$mechanic_data
->
row
();
$mechData
->
custom_service_quote
=
json_decode
(
$mechData
->
custom_service_quote
);
$book
->
mechanic_data
[]
=
$mechData
;
$sTime
=
strtotime
(
$book
->
scheduled_date
.
' '
.
$book
->
scheduled_time
);
$cTime
=
strtotime
(
'+1 hour'
);
if
(
$cTime
>=
$sTime
){
$book
->
status
=
'4'
;
}
return
0
;
}
}
}
$bookDetails
[]
=
$book
;
}
return
$bookDetails
;
}
function
changeBookStatus
(
$customer_id
=
''
,
$booking_id
=
''
,
$status
=
''
){
...
...
@@ -114,27 +179,62 @@ class Booking_model extends CI_Model {
$cond
=
" BK.status IN ("
.
$status
.
") "
;
$cond
.=
(
!
empty
(
$booking_id
))
?
" AND BK.booking_id='"
.
$booking_id
.
"' "
:
""
;
$cond
.=
(
!
empty
(
$mechanic_id
))
?
" AND
BK.mechanic_id='"
.
$mechanic_id
.
"' "
:
""
;
$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,BK.mileage,BK.issues_selected,VEH.car_nam
e,
BK.custom_issue_data,MECH.first_name AS mechFirstName,VEH.car_model
,
MECH.last_name AS mechLastName,VEH.car_maker,VEH.car_model_year,VEH.car_vin
,
VEH.vehicle_data,VEH.car_location,VEH.car_loc_lat,VEH.car_loc_lng
,
CUST.first_name AS custFirstName,CUST.last_name AS custLastName,CUST.phone
,
CUST.email,CUST.address,CUST.profile_image,CUST.date_of_birth,CUSQTE.custom_id
$cond
.=
(
!
empty
(
$mechanic_id
))
?
" AND M
BK.mechanic_id='"
.
$mechanic_id
.
"' "
:
""
;
$sql
=
"SELECT GROUP_CONCAT(DISTINCT(MBK.mechanic_id)) AS mechanic_ids,BK.booking_id,BK.customer_id
,
BK.customer_veh_id,BK.scheduled_date,BK.scheduled_time,BK.cost,BK.status,BK.mileag
e,
BK.issues_selected,VEH.car_name,BK.custom_issue_data,VEH.car_model,VEH.car_maker
,
VEH.car_model_year,VEH.car_vin,VEH.vehicle_data,BK.car_location,BK.car_loc_lat
,
BK.car_loc_lng,CUST.first_name AS custFirstName,CUST.last_name AS custLastName,CUST.phone
,
CUST.email,CUST.address,CUST.profile_image,CUST.date_of_birth,CUSQTE.custom_id
,
MBK.status AS mech_status
FROM bookings AS BK
INNER JOIN mechanic AS MECH ON (MECH.mechanic_id=BK.mechanic
_id)
INNER JOIN mechanic_booking AS MBK ON (MBK.booking_id=BK.booking
_id)
INNER JOIN customers AS CUST ON (CUST.customer_id=BK.customer_id)
INNER JOIN admin_users AS ADM ON (ADM.id=
BK.mechanic_id)
INNER JOIN admin_users AS ADM ON (ADM.id=M
BK.mechanic_id)
INNER JOIN customer_vehicle AS VEH ON (VEH.customer_veh_id=BK.customer_veh_id)
LEFT JOIN custom_quote AS CUSQTE on (CUSQTE.booking_id = BK.booking_id)
LEFT JOIN custom_quote AS CUSQTE on (CUSQTE.booking_id = BK.booking_id
AND CUSQTE.mechanic_id=MBK.mechanic_id)
WHERE
$cond
AND ADM.status='1' AND CUST.status='1'
GROUP BY BK.booking_id"
;
$bookData
=
$this
->
db
->
query
(
$sql
);
if
(
!
empty
(
$bookData
)){
$bookData
=
(
!
empty
(
$booking_id
))
?
$bookData
->
row
()
:
$bookData
->
result
();
if
(
empty
(
$booking_id
)){
return
$bookData
->
result
();
}
$bookedMechanics
=
array
();
$bookData
=
$bookData
->
row
();
if
(
!
empty
(
$bookData
->
mechanic_ids
)){
$mechanics
=
explode
(
','
,
$bookData
->
mechanic_ids
);
foreach
(
$mechanics
AS
$mech_id
)
{
$mechanic_data
=
$this
->
db
->
query
(
"
SELECT ROUND(AVG(MR.rate),2) AS rating,MCH.mechanic_id,MCH.first_name,
MCH.last_name,MCH.phone,CQ.custom_service_quote,MCH.location,
MCH.email_id,CQ.custom_amount,
CASE
WHEN BK.status = '0' THEN 'Pending'
WHEN BK.status = '1' THEN 'Accept'
ELSE 'Reject' END as status
FROM mechanic_booking AS BK
INNER JOIN mechanic MCH ON BK.mechanic_id=MCH.mechanic_id
INNER JOIN admin_users AU ON AU.id=MCH.mechanic_id
LEFT JOIN custom_quote CQ ON
CQ.mechanic_id=BK.mechanic_id AND
CQ.booking_id=BK.booking_id AND CQ.status='1'
LEFT JOIN mechanic_rating MR ON
MR.mechanic_id=BK.mechanic_id AND MR.status='1'
WHERE AU.status='1' AND BK.mechanic_id='
$mech_id
' AND BK.booking_id='
$booking_id
'"
);
if
(
!
empty
(
$mechanic_data
)){
$mechData
=
$mechanic_data
->
row
();
$mechData
->
custom_service_quote
=
json_decode
(
$mechData
->
custom_service_quote
);
$bookedMechanics
[]
=
$mechData
;
}
}
$bookData
->
mechanic_data
=
$bookedMechanics
;
}
// pr($bookData);
return
$bookData
;
}
return
0
;
...
...
@@ -144,17 +244,47 @@ class Booking_model extends CI_Model {
if
(
empty
(
$booking_id
)){
return
0
;
}
$status
=
$this
->
db
->
update
(
'bookings'
,
array
(
'status'
=>
$status
),
array
(
'booking_id'
=>
$booking_id
));
if
(
$this
->
session
->
userdata
(
'user_type'
)
==
1
){
if
(
$status
==
'1'
){
$status
=
$this
->
db
->
update
(
'bookings'
,
array
(
'status'
=>
'0'
),
array
(
'booking_id'
=>
$booking_id
));
}
else
if
(
$status
==
'4'
){
$status
=
$this
->
db
->
update
(
'bookings'
,
array
(
'status'
=>
'4'
),
array
(
'booking_id'
=>
$booking_id
));
}
else
if
(
$status
==
'2'
){
$this
->
db
->
update
(
'bookings'
,
array
(
'status'
=>
'2'
),
array
(
'booking_id'
=>
$booking_id
));
}
}
else
{
$id
=
$this
->
session
->
userdata
(
'id'
);
if
(
$status
==
'4'
){
$this
->
db
->
update
(
'mechanic_booking'
,
array
(
'status'
=>
'2'
),
array
(
'booking_id'
=>
$booking_id
,
'mechanic_id'
=>
$id
));
}
else
if
(
$status
==
'1'
){
$this
->
db
->
update
(
'mechanic_booking'
,
array
(
'status'
=>
'1'
),
array
(
'booking_id'
=>
$booking_id
,
'mechanic_id'
=>
$id
));
}
else
if
(
$status
==
'2'
){
$this
->
db
->
update
(
'mechanic_booking'
,
array
(
'status'
=>
'2'
),
array
(
'booking_id'
=>
$booking_id
,
'mechanic_id'
=>
$id
));
}
}
return
$status
;
}
function
insertCustomQuote
(
$data
){
$custData
=
array
();
$total
=
0
;
$book_id
=
decode_param
(
$data
[
'booking_id'
]);
$mechanic_id
=
(
$this
->
session
->
userdata
(
'user_type'
)
==
2
)
?
$this
->
session
->
userdata
(
'id'
)
:
''
;
unset
(
$data
[
'booking_id'
]);
for
(
$i
=
0
;
$i
<
count
(
$data
[
'description'
]);
$i
++
){
$custData
[
$i
][
'issue_id'
]
=
$data
[
'issue_id'
][
$i
];
$custData
[
$i
][
'sub_issue_id'
]
=
$data
[
'sub_issue_id'
][
$i
];
$custData
[
$i
][
'issue_category'
]
=
$data
[
'issue_category'
][
$i
];
$custData
[
$i
][
'description'
]
=
$data
[
'description'
][
$i
];
$custData
[
$i
][
'amount'
]
=
$data
[
'amount'
][
$i
];
$total
+=
$data
[
'amount'
][
$i
];
...
...
@@ -162,10 +292,10 @@ class Booking_model extends CI_Model {
$book_data
=
$this
->
db
->
get_where
(
'custom_quote'
,
array
(
'booking_id'
=>
$book_id
));
if
(
!
empty
(
$book_data
)
&&
$book_data
->
num_rows
()
>
0
){
$this
->
db
->
update
(
'custom_quote'
,
array
(
'custom_service_quote'
=>
json_encode
(
$custData
)
,
'custom_amount'
=>
$total
),
array
(
'booking_id'
=>
$book_id
));
$this
->
db
->
update
(
'custom_quote'
,
array
(
'custom_service_quote'
=>
json_encode
(
$custData
),
'mechanic_id'
=>
$mechanic_id
,
'custom_amount'
=>
$total
),
array
(
'booking_id'
=>
$book_id
));
$res
=
array
(
'status'
=>
'success'
);
}
else
{
if
(
$this
->
db
->
insert
(
'custom_quote'
,
array
(
'booking_id'
=>
$book
_id
,
'custom_service_quote'
=>
json_encode
(
$custData
),
'custom_amount'
=>
$total
))){
if
(
$this
->
db
->
insert
(
'custom_quote'
,
array
(
'booking_id'
=>
$book_id
,
'mechanic_id'
=>
$mechanic
_id
,
'custom_service_quote'
=>
json_encode
(
$custData
),
'custom_amount'
=>
$total
))){
$last_id
=
$this
->
db
->
insert_id
();
$res
=
array
(
'status'
=>
'success'
,
'data'
=>
encode_param
(
$last_id
));
}
...
...
application/models/Mechanic_model.php
View file @
36c641a9
...
...
@@ -150,9 +150,9 @@ class Mechanic_model extends CI_Model {
POWER(SIN((
$current_lng
-ME.location_lng)*pi()/180/2),2) )) AS distance
FROM mechanic AS ME
INNER JOIN admin_users AS AU ON (AU.id=ME.mechanic_id)
LEFT JOIN mechanic_rating AS MR ON (MR.mechanic_id=ME.mechanic_id)
LEFT JOIN mechanic_shop AS MS ON (MS.shop_id=ME.shop_id AND MS.status='1')
WHERE AU.status='1'
-- GROUP BY ME.mechanic_id
-- HAVING distance<30"
;
$mechData
=
$this
->
db
->
query
(
$sql
);
...
...
application/models/Webservice_model.php
View file @
36c641a9
...
...
@@ -513,6 +513,7 @@ class Webservice_model extends CI_Model {
$respArr
[
'message'
]
=
'Sorry, You are already Rated for this mechanic'
;
return
$respArr
;
}
$postData
[
'status'
]
=
'1'
;
if
(
$this
->
db
->
insert
(
'mechanic_rating'
,
$postData
)){
$respArr
[
'status'
]
=
'success'
;
$respArr
[
'message'
]
=
'success'
;
...
...
@@ -520,5 +521,25 @@ class Webservice_model extends CI_Model {
return
$respArr
;
}
public
function
acceptMechanicQuote
(
$postData
){
$respArr
=
array
(
'status'
=>
'error'
,
'message'
=>
'Something went Wrong.. Try Again'
);
if
(
empty
(
$postData
[
'bookingId'
])){
$respArr
[
'message'
]
=
'Booking Id is Required'
;
return
$respArr
;
}
if
(
empty
(
$postData
[
'mechanicId'
])){
$respArr
[
'message'
]
=
'Mechanic Id is Required'
;
return
$respArr
;
}
if
(
$this
->
db
->
update
(
'mechanic_booking'
,
array
(
'status'
=>
'1'
),
array
(
'booking_id'
=>
$postData
[
'bookingId'
],
'mechanic_id'
=>
$postData
[
'mechanicId'
]))){
$this
->
db
->
update
(
'mechanic_booking'
,
array
(
'status'
=>
'2'
),
array
(
'booking_id'
=>
$postData
[
'bookingId'
],
'mechanic_id !='
=>
$postData
[
'mechanicId'
]));
$this
->
db
->
update
(
'bookings'
,
array
(
'status'
=>
'1'
),
array
(
'booking_id'
=>
$postData
[
'bookingId'
]));
$respArr
[
'status'
]
=
'success'
;
$respArr
[
'message'
]
=
'Updated Successfully'
;
}
return
$respArr
;
}
}
?>
application/views/Bookings/list-booking.php
View file @
36c641a9
...
...
@@ -69,7 +69,7 @@
<tr>
<th
class=
"hidden"
>
ID
</th>
<th
width=
"18%;"
>
Car Name
</th>
<
th
width=
"12%;"
>
Mechanic
</th
>
<
!-- <th width="12%;">Mechanic</th> --
>
<th
width=
"12%;"
>
Customer
</th>
<th
width=
"15%;"
>
Scheduled Date
</th>
<th
width=
"11%;"
>
Service Fee
</th>
...
...
@@ -84,7 +84,6 @@
<tr>
<th
class=
"hidden"
>
<?=
$bookData
->
booking_id
?>
</th>
<th
class=
"center"
>
<?=
$bookData
->
car_name
?>
</th>
<th
class=
"center"
>
<?=
$bookData
->
mechFirstName
.
' '
.
$bookData
->
mechLastName
?>
</th>
<th
class=
"center"
>
<?=
$bookData
->
custFirstName
.
' '
.
$bookData
->
custLastName
?>
</th>
<th
class=
"center"
>
<?=
$bookData
->
scheduled_date
.
' '
.
$bookData
->
scheduled_time
?>
...
...
@@ -92,40 +91,61 @@
<th
class=
"center"
>
<?=
$bookData
->
cost
?>
</th>
<th
class=
"center"
>
<?php
if
(
$this
->
session
->
userdata
[
'user_type'
]
==
1
){
switch
(
$bookData
->
status
){
case
0
:
echo
'Pending'
;
break
;
case
1
:
echo
'Accepted'
;
break
;
case
3
:
echo
'Completed'
;
break
;
case
4
:
echo
'Cancelled'
;
break
;
}
}
else
{
switch
(
$bookData
->
mech_status
){
case
0
:
echo
'Pending'
;
break
;
case
1
:
echo
'Accepted'
;
break
;
case
2
:
echo
'Rejected'
;
break
;
}
}
?>
</th>
<td
class=
"center
float-right
"
>
<td
class=
"center"
>
<button
class=
"btn btn-sm btn-primary"
booking_id=
"
<?=
encode_param
(
$bookData
->
booking_id
)
?>
"
id=
"showBookinDetails"
>
<i
class=
"fa fa-fw fa-edit"
></i>
View Quote
</button>
<?php
if
(
$bookData
->
status
==
1
){
?>
<?php
if
(
$this
->
session
->
userdata
[
'user_type'
]
==
1
){
if
(
$bookData
->
status
==
0
||
$bookData
->
status
==
1
){
?>
<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
</a>
<?php
}
?>
<?php
if
(
$bookData
->
status
==
0
||
$bookData
->
status
==
4
){
?>
<?php
}
if
(
$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
))
?>
"
>
<i
class=
"fa fa-cog"
></i>
Accept
</a>
<?php
}
?>
<?php
}
}
else
{
if
(
$bookData
->
mech_status
==
0
||
$bookData
->
mech_status
==
1
){
?>
<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
</a>
<?php
}
if
(
$bookData
->
mech_status
==
2
||
$bookData
->
mech_status
==
0
){
?>
<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
</a>
<?php
}
}
?>
<a
class=
"btn btn-sm btn-danger"
href=
"
<?=
base_url
(
"Bookings/changeBookingStatus/"
.
encode_param
(
$bookData
->
booking_id
)
.
"/2/"
.
encode_param
(
$mechanic_id
))
?>
"
onClick=
"return doconfirm()"
>
<i
class=
"fa fa-fw fa-trash"
></i>
Delete
</a>
<?php
if
(
$bookData
->
custom_id
==
''
){
if
(
$this
->
session
->
userdata
[
'user_type'
]
!=
1
){
?>
if
(
$this
->
session
->
userdata
[
'user_type'
]
!=
1
){
?>
<button
class=
"btn btn-sm btn-primary"
style=
"margin-top:3px;"
booking_id=
"
<?=
encode_param
(
$bookData
->
booking_id
)
?>
"
id=
"customQuote"
view=
"0"
>
<i
class=
"fa fa-fw fa-edit"
></i><span>
Generate Custom Quote
</span>
</button>
<?php
}
}
else
{
?>
<?php
}
?>
<?php
}
else
{
?>
<button
class=
"btn btn-sm btn-primary"
style=
"margin-top:3px;"
booking_id=
"
<?=
encode_param
(
$bookData
->
custom_id
)
?>
"
id=
"customQuote"
view=
"1"
>
<i
class=
"fa fa-fw fa-edit"
></i><span>
View Custom Quote
</span>
</button>
...
...
application/views/Templates/footer-script.php
View file @
36c641a9
...
...
@@ -52,7 +52,7 @@
jQuery
(
function
()
{
jQuery
(
'.datatable'
)
.
DataTable
({
"ordering"
:
jQuery
(
this
)
.
data
(
"ordering"
),
"order"
:
[[
0
,
"
a
sc"
]]
"order"
:
[[
0
,
"
de
sc"
]]
});
});
<?
php
//} ?>
...
...
assets/js/custom-script.js
View file @
36c641a9
...
...
@@ -830,7 +830,8 @@ function customQuote(thisObj){
'</div>'
+
'<input type="hidden" name="issue_id[]" value="'
+
value
[
'issue_id'
]
+
'">'
+
'<input type="hidden" name="sub_issue_id[]" value="'
+
value
[
'sub_issue_id'
]
+
'">'
+
'</div>'
;
'</div>'
+
'<input type="hidden" name="issue_category[]" value="'
+
value
[
'issue_category'
]
+
'">'
;
});
issueHtml
+=
'<input type="hidden" id="array_count" name="count" value="'
+
issues_selected
.
length
+
'">'
+
'</div>'
+
...
...
@@ -1113,11 +1114,6 @@ jQuery('[id="showBookinDetails"]').on('click',function() {
'<div class="col-md-6"><label>'
+
booking_data
[
'custFirstName'
]
+
' '
+
booking_data
[
'custLastName'
]
+
'</label></div>'
+
'</div> '
+
'<div class="row">'
+
'<div class="col-md-4">Mechanic</div>'
+
'<div class="col-md-1">:</div>'
+
'<div class="col-md-6"><label>'
+
booking_data
[
'mechFirstName'
]
+
' '
+
booking_data
[
'mechLastName'
]
+
'</label></div>'
+
'</div> '
+
'<div class="row">'
+
'<div class="col-md-4">Current Milage</div>'
+
'<div class="col-md-1">:</div>'
+
'<div class="col-md-6"><label>'
+
booking_data
[
'mileage'
]
+
'</label></div>'
+
...
...
@@ -1165,7 +1161,26 @@ jQuery('[id="showBookinDetails"]').on('click',function() {
'<div class="col-md-1">:</div>'
+
'<div class="col-md-6"><label>'
+
booking_data
[
'car_location'
]
+
'</label></div>'
+
'</div> '
+
'</div> '
+
issueHtml
+
optionalHtml
+
'</div> '
+
issueHtml
+
'<div class="col-md-12"> '
+
'<div class="row"><label>Mechanic Details</label></div>'
+
'<div class="col-md-3"><div class="row"><label>Mechanic Name</label></div></div>'
+
'<div class="col-md-3"><div class="row"><label>Amount</label></div></div>'
+
'<div class="col-md-2"><div class="row"><label>status</label></div></div>'
+
'<div class="row">'
;
jQuery
.
each
(
booking_data
[
'mechanic_data'
],
function
(
index1
,
value1
)
{
if
(
value1
[
'custom_amount'
]
==
''
||
value1
[
'custom_amount'
]
==
null
||
value1
[
'custom_amount'
]
==
undefined
||
value1
[
'custom_amount'
]
==
'null'
||
value1
[
'custom_amount'
]
==
'undefined'
){
value1
[
'custom_amount'
]
=
booking_data
[
'cost'
];
}
html
+=
'<div class="col-md-12">'
+
'<div class="col-md-3">'
+
value1
[
'first_name'
]
+
' '
+
value1
[
'last_name'
]
+
'</div>'
+
'<div class="col-md-3">'
+
value1
[
'custom_amount'
]
+
'</div>'
+
'<div class="col-md-2">'
+
value1
[
'status'
]
+
'</div>'
+
'</div>'
;
});
html
+=
'</div>'
+
'</div>'
+
optionalHtml
+
'</div>'
;
remModalLoader
();
...
...
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