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
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
108 additions
and
40 deletions
+108
-40
Bookings.php
application/controllers/Bookings.php
+1
-0
Webservices.php
application/controllers/Webservices.php
+14
-3
Booking_model.php
application/models/Booking_model.php
+0
-0
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
+48
-28
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 {
...
@@ -40,6 +40,7 @@ class Bookings extends CI_Controller {
empty
(
$mechanic_id
))
?
''
:
$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'
);
//pr($template['bookingData']);
$this
->
load
->
view
(
'template'
,
$template
);
$this
->
load
->
view
(
'template'
,
$template
);
}
}
...
...
application/controllers/Webservices.php
View file @
36c641a9
...
@@ -285,9 +285,9 @@
...
@@ -285,9 +285,9 @@
header
(
'Content-type: application/json'
);
header
(
'Content-type: application/json'
);
$postData
=
$_POST
;
$postData
=
$_POST
;
$optionalData
=
array
(
'optionlaDescription'
=>
''
,
'optionalImages'
=>
array
(),
'optionalVideos'
=>
array
());
$optionalData
=
array
(
'optionlaDescription'
=>
''
,
'optionalImages'
=>
array
(),
'optionalVideos'
=>
array
());
$respArr
=
array
(
'status'
=>
'0'
,
'message'
=>
'Something went wrong.'
);
$respArr
=
array
(
'status'
=>
'0'
,
'message'
=>
'Something went wrong.'
);
//pr(json_decode($postData['data']));
if
(
empty
(
$postData
)
||
empty
(
$postData
=
json_decode
(
$postData
[
'data'
],
true
))
||
if
(
empty
(
$postData
)
||
empty
(
$postData
=
json_decode
(
$postData
[
'data'
],
true
))
||
!
isset
(
$postData
[
'cost'
])
||
empty
(
$postData
[
'cost'
])
||
!
isset
(
$postData
[
'cost'
])
||
empty
(
$postData
[
'cost'
])
||
!
isset
(
$postData
[
'customer_id'
])
||
empty
(
$postData
[
'customer_id'
])
||
!
isset
(
$postData
[
'customer_id'
])
||
empty
(
$postData
[
'customer_id'
])
||
...
@@ -472,7 +472,7 @@
...
@@ -472,7 +472,7 @@
echo
json_encode
(
$respArr
);
exit
;
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
){
if
(
$status
){
$respArr
[
'status'
]
=
1
;
$respArr
[
'status'
]
=
1
;
...
@@ -1343,6 +1343,17 @@
...
@@ -1343,6 +1343,17 @@
$result
=
$this
->
Webservice_model
->
rate_mechanic
(
$postData
);
$result
=
$this
->
Webservice_model
->
rate_mechanic
(
$postData
);
echo
json_encode
(
$result
);
exit
;
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
This diff is collapsed.
Click to expand it.
application/models/Mechanic_model.php
View file @
36c641a9
...
@@ -150,9 +150,9 @@ class Mechanic_model extends CI_Model {
...
@@ -150,9 +150,9 @@ class Mechanic_model extends CI_Model {
POWER(SIN((
$current_lng
-ME.location_lng)*pi()/180/2),2) )) AS distance
POWER(SIN((
$current_lng
-ME.location_lng)*pi()/180/2),2) )) AS distance
FROM mechanic AS ME
FROM mechanic AS ME
INNER JOIN admin_users AS AU ON (AU.id=ME.mechanic_id)
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')
LEFT JOIN mechanic_shop AS MS ON (MS.shop_id=ME.shop_id AND MS.status='1')
WHERE AU.status='1'
WHERE AU.status='1'
-- GROUP BY ME.mechanic_id
-- HAVING distance<30"
;
-- HAVING distance<30"
;
$mechData
=
$this
->
db
->
query
(
$sql
);
$mechData
=
$this
->
db
->
query
(
$sql
);
...
...
application/models/Webservice_model.php
View file @
36c641a9
...
@@ -513,12 +513,33 @@ class Webservice_model extends CI_Model {
...
@@ -513,12 +513,33 @@ class Webservice_model extends CI_Model {
$respArr
[
'message'
]
=
'Sorry, You are already Rated for this mechanic'
;
$respArr
[
'message'
]
=
'Sorry, You are already Rated for this mechanic'
;
return
$respArr
;
return
$respArr
;
}
}
$postData
[
'status'
]
=
'1'
;
if
(
$this
->
db
->
insert
(
'mechanic_rating'
,
$postData
)){
if
(
$this
->
db
->
insert
(
'mechanic_rating'
,
$postData
)){
$respArr
[
'status'
]
=
'success'
;
$respArr
[
'status'
]
=
'success'
;
$respArr
[
'message'
]
=
'success'
;
$respArr
[
'message'
]
=
'success'
;
}
}
return
$respArr
;
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 @@
...
@@ -69,7 +69,7 @@
<tr>
<tr>
<th
class=
"hidden"
>
ID
</th>
<th
class=
"hidden"
>
ID
</th>
<th
width=
"18%;"
>
Car Name
</th>
<th
width=
"18%;"
>
Car Name
</th>
<
th
width=
"12%;"
>
Mechanic
</th
>
<
!-- <th width="12%;">Mechanic</th> --
>
<th
width=
"12%;"
>
Customer
</th>
<th
width=
"12%;"
>
Customer
</th>
<th
width=
"15%;"
>
Scheduled Date
</th>
<th
width=
"15%;"
>
Scheduled Date
</th>
<th
width=
"11%;"
>
Service Fee
</th>
<th
width=
"11%;"
>
Service Fee
</th>
...
@@ -84,7 +84,6 @@
...
@@ -84,7 +84,6 @@
<tr>
<tr>
<th
class=
"hidden"
>
<?=
$bookData
->
booking_id
?>
</th>
<th
class=
"hidden"
>
<?=
$bookData
->
booking_id
?>
</th>
<th
class=
"center"
>
<?=
$bookData
->
car_name
?>
</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
->
custFirstName
.
' '
.
$bookData
->
custLastName
?>
</th>
<th
class=
"center"
>
<th
class=
"center"
>
<?=
$bookData
->
scheduled_date
.
' '
.
$bookData
->
scheduled_time
?>
<?=
$bookData
->
scheduled_date
.
' '
.
$bookData
->
scheduled_time
?>
...
@@ -92,44 +91,65 @@
...
@@ -92,44 +91,65 @@
<th
class=
"center"
>
<?=
$bookData
->
cost
?>
</th>
<th
class=
"center"
>
<?=
$bookData
->
cost
?>
</th>
<th
class=
"center"
>
<th
class=
"center"
>
<?php
<?php
switch
(
$bookData
->
status
){
if
(
$this
->
session
->
userdata
[
'user_type'
]
==
1
){
case
0
:
echo
'Pending'
;
break
;
switch
(
$bookData
->
status
){
case
1
:
echo
'Accepted'
;
break
;
case
0
:
echo
'Pending'
;
break
;
case
3
:
echo
'Completed'
;
break
;
case
1
:
echo
'Accepted'
;
break
;
case
4
:
echo
'Cancelled'
;
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>
</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"
>
<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
<i
class=
"fa fa-fw fa-edit"
></i>
View Quote
</button>
</button>
<?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
)
.
"/4/"
.
encode_param
(
$mechanic_id
))
?>
"
>
<i
class=
"fa fa-cog"
></i>
Cancel
<?php
if
(
$this
->
session
->
userdata
[
'user_type'
]
==
1
){
</a>
if
(
$bookData
->
status
==
0
||
$bookData
->
status
==
1
){
?>
<?php
}
?>
<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
))
?>
"
>
<?php
if
(
$bookData
->
status
==
0
||
$bookData
->
status
==
4
){
?>
<i
class=
"fa fa-cog"
></i>
Cancel
<a
class=
"btn btn-sm btn-success"
href=
"
<?=
base_url
(
"Bookings/changeBookingStatus/"
.
encode_param
(
$bookData
->
booking_id
)
.
"/1/"
.
encode_param
(
$mechanic_id
))
?>
"
>
</a>
<i
class=
"fa fa-cog"
></i>
Accept
<?php
}
if
(
$bookData
->
status
==
4
){
?>
</a>
<a
class=
"btn btn-sm btn-success"
href=
"
<?=
base_url
(
"Bookings/changeBookingStatus/"
.
encode_param
(
$bookData
->
booking_id
)
.
"/1/"
.
encode_param
(
$mechanic_id
))
?>
"
>
<?php
}
?>
<i
class=
"fa fa-cog"
></i>
Accept
</a>
<?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"
<a
class=
"btn btn-sm btn-danger"
href=
"
<?=
base_url
(
"Bookings/changeBookingStatus/"
.
encode_param
(
$bookData
->
booking_id
)
.
"/2/"
.
encode_param
(
$mechanic_id
))
?>
"
href=
"
<?=
base_url
(
"Bookings/changeBookingStatus/"
.
encode_param
(
$bookData
->
booking_id
)
.
"/2/"
.
encode_param
(
$mechanic_id
))
?>
"
onClick=
"return doconfirm()"
>
onClick=
"return doconfirm()"
>
<i
class=
"fa fa-fw fa-trash"
></i>
Delete
<i
class=
"fa fa-fw fa-trash"
></i>
Delete
</a>
</a>
<?php
if
(
$bookData
->
custom_id
==
''
){
<?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"
>
<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
>
<i
class=
"fa fa-fw fa-edit"
></i><span>
Generate Custom Quote
</span>
</button>
</button>
<?php
}
?>
<?php
}
}
else
{
?>
<?php
}
else
{
?>
<button
class=
"btn btn-sm btn-primary"
style=
"margin-top:3px;"
booking_id=
"
<?=
encode_param
(
$bookData
->
custom_id
)
?>
"
id=
"customQuote"
view=
"1"
>
<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>
<i
class=
"fa fa-fw fa-edit"
></i><span>
View Custom Quote
</span>
</button>
</button>
<?php
}
?>
<?php
}
?>
</td>
</td>
</tr>
</tr>
<?php
}
}
?>
<?php
}
}
?>
...
...
application/views/Templates/footer-script.php
View file @
36c641a9
...
@@ -52,7 +52,7 @@
...
@@ -52,7 +52,7 @@
jQuery
(
function
()
{
jQuery
(
function
()
{
jQuery
(
'.datatable'
)
.
DataTable
({
jQuery
(
'.datatable'
)
.
DataTable
({
"ordering"
:
jQuery
(
this
)
.
data
(
"ordering"
),
"ordering"
:
jQuery
(
this
)
.
data
(
"ordering"
),
"order"
:
[[
0
,
"
a
sc"
]]
"order"
:
[[
0
,
"
de
sc"
]]
});
});
});
});
<?
php
//} ?>
<?
php
//} ?>
...
...
assets/js/custom-script.js
View file @
36c641a9
...
@@ -830,7 +830,8 @@ function customQuote(thisObj){
...
@@ -830,7 +830,8 @@ function customQuote(thisObj){
'</div>'
+
'</div>'
+
'<input type="hidden" name="issue_id[]" value="'
+
value
[
'issue_id'
]
+
'">'
+
'<input type="hidden" name="issue_id[]" value="'
+
value
[
'issue_id'
]
+
'">'
+
'<input type="hidden" name="sub_issue_id[]" value="'
+
value
[
'sub_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
+
'">'
+
issueHtml
+=
'<input type="hidden" id="array_count" name="count" value="'
+
issues_selected
.
length
+
'">'
+
'</div>'
+
'</div>'
+
...
@@ -1113,11 +1114,6 @@ jQuery('[id="showBookinDetails"]').on('click',function() {
...
@@ -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 class="col-md-6"><label>'
+
booking_data
[
'custFirstName'
]
+
' '
+
booking_data
[
'custLastName'
]
+
'</label></div>'
+
'</div> '
+
'</div> '
+
'<div class="row">'
+
'<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-4">Current Milage</div>'
+
'<div class="col-md-1">:</div>'
+
'<div class="col-md-1">:</div>'
+
'<div class="col-md-6"><label>'
+
booking_data
[
'mileage'
]
+
'</label></div>'
+
'<div class="col-md-6"><label>'
+
booking_data
[
'mileage'
]
+
'</label></div>'
+
...
@@ -1165,7 +1161,26 @@ jQuery('[id="showBookinDetails"]').on('click',function() {
...
@@ -1165,7 +1161,26 @@ jQuery('[id="showBookinDetails"]').on('click',function() {
'<div class="col-md-1">:</div>'
+
'<div class="col-md-1">:</div>'
+
'<div class="col-md-6"><label>'
+
booking_data
[
'car_location'
]
+
'</label></div>'
+
'<div class="col-md-6"><label>'
+
booking_data
[
'car_location'
]
+
'</label></div>'
+
'</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>'
;
'</div>'
;
remModalLoader
();
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