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
155eecb3
Commit
155eecb3
authored
Feb 20, 2019
by
Jansa Jose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservice and admin panel view custom quote
parent
21118e16
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
156 additions
and
9 deletions
+156
-9
Bookings.php
application/controllers/Bookings.php
+21
-1
Booking_model.php
application/models/Booking_model.php
+17
-2
Webservice_model.php
application/models/Webservice_model.php
+2
-1
list-booking.php
application/views/Bookings/list-booking.php
+8
-2
custom-script.js
assets/js/custom-script.js
+108
-3
No files found.
application/controllers/Bookings.php
View file @
155eecb3
...
@@ -65,13 +65,15 @@ class Bookings extends CI_Controller {
...
@@ -65,13 +65,15 @@ class Bookings extends CI_Controller {
echo
json_encode
(
$return_arr
);
exit
;
echo
json_encode
(
$return_arr
);
exit
;
}
}
$booking_id
=
decode_param
(
$_POST
[
'booking_id'
]);
$booking_id
=
decode_param
(
$_POST
[
'booking_id'
]);
$bookingData
=
$this
->
Booking_model
->
getMechBookings
(
''
,
$booking_id
,
'0,1,3,4'
);
$mechanic_id
=
(
$this
->
session
->
userdata
(
'user_type'
)
==
2
)
?
$this
->
session
->
userdata
(
'id'
)
:
''
;
$bookingData
=
$this
->
Booking_model
->
getMechBookings
(
$mechanic_id
,
$booking_id
,
'0,1,3,4'
);
if
(
!
empty
(
$bookingData
)){
if
(
!
empty
(
$bookingData
)){
$return_arr
[
'status'
]
=
1
;
$return_arr
[
'status'
]
=
1
;
$return_arr
[
'data'
]
=
$bookingData
;
$return_arr
[
'data'
]
=
$bookingData
;
echo
json_encode
(
$return_arr
);
exit
;
echo
json_encode
(
$return_arr
);
exit
;
}
}
echo
json_encode
(
$return_arr
);
exit
;
}
}
public
function
insertCustomQuote
(){
public
function
insertCustomQuote
(){
...
@@ -85,5 +87,22 @@ class Bookings extends CI_Controller {
...
@@ -85,5 +87,22 @@ class Bookings extends CI_Controller {
$return_arr
=
$this
->
Booking_model
->
insertCustomQuote
(
$output
);
$return_arr
=
$this
->
Booking_model
->
insertCustomQuote
(
$output
);
echo
json_encode
(
$return_arr
);
exit
;
echo
json_encode
(
$return_arr
);
exit
;
}
}
public
function
getCustomData
(){
$return_arr
=
array
(
'status'
=>
'0'
);
if
(
!
isset
(
$_POST
)
||
empty
(
$_POST
)
||
!
isset
(
$_POST
[
'custom_id'
])
||
empty
(
$_POST
[
'custom_id'
])
||
empty
(
decode_param
(
$_POST
[
'custom_id'
]))){
echo
json_encode
(
$return_arr
);
exit
;
}
$custom_booking_id
=
decode_param
(
$_POST
[
'custom_id'
]);
// print_r($custom_booking_id);exit();
$CustData
=
$this
->
Booking_model
->
getCustomData
(
$custom_booking_id
);
if
(
!
empty
(
$CustData
)){
$return_arr
[
'status'
]
=
1
;
$return_arr
[
'data'
]
=
$CustData
;
echo
json_encode
(
$return_arr
);
exit
;
}
echo
json_encode
(
$return_arr
);
exit
;
}
}
}
?>
?>
\ No newline at end of file
application/models/Booking_model.php
View file @
155eecb3
...
@@ -119,12 +119,13 @@ class Booking_model extends CI_Model {
...
@@ -119,12 +119,13 @@ class Booking_model extends CI_Model {
MECH.last_name AS mechLastName,VEH.car_maker,VEH.car_model_year,VEH.car_vin,
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,
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.first_name AS custFirstName,CUST.last_name AS custLastName,CUST.phone,
CUST.email,CUST.address,CUST.profile_image,CUST.date_of_birth
CUST.email,CUST.address,CUST.profile_image,CUST.date_of_birth
,CUSQTE.custom_id
FROM bookings AS BK
FROM bookings AS BK
INNER JOIN mechanic AS MECH ON (MECH.mechanic_id=BK.mechanic_id)
INNER JOIN mechanic AS MECH ON (MECH.mechanic_id=BK.mechanic_id)
INNER JOIN customers AS CUST ON (CUST.customer_id=BK.customer_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=BK.mechanic_id)
INNER JOIN customer_vehicle AS VEH ON (VEH.customer_veh_id=BK.customer_veh_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)
WHERE
$cond
AND ADM.status='1' AND CUST.status='1'
WHERE
$cond
AND ADM.status='1' AND CUST.status='1'
GROUP BY BK.booking_id"
;
GROUP BY BK.booking_id"
;
...
@@ -162,10 +163,24 @@ class Booking_model extends CI_Model {
...
@@ -162,10 +163,24 @@ class Booking_model extends CI_Model {
$res
=
array
(
'status'
=>
'success'
);
$res
=
array
(
'status'
=>
'success'
);
}
else
{
}
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
,
'custom_service_quote'
=>
json_encode
(
$custData
),
'custom_amount'
=>
$total
))){
$res
=
array
(
'status'
=>
'success'
);
$last_id
=
$this
->
db
->
insert_id
();
$res
=
array
(
'status'
=>
'success'
,
'data'
=>
encode_param
(
$last_id
));
}
}
}
}
return
$res
;
return
$res
;
}
}
public
function
getCustomData
(
$customid
){
$this
->
db
->
select
(
'custom_quote.custom_service_quote,custom_quote.custom_amount,bookings.issues_selected'
);
$this
->
db
->
join
(
'bookings'
,
'bookings.booking_id = custom_quote.booking_id'
);
$this
->
db
->
where
(
'custom_quote.custom_id'
,
$customid
);
$custData
=
$this
->
db
->
get
(
'custom_quote'
);
if
(
!
empty
(
$custData
)
&&
$custData
->
num_rows
()
>
0
){
$custData
=
$custData
->
row_array
();
return
$custData
;
}
return
0
;
}
}
}
?>
?>
application/models/Webservice_model.php
View file @
155eecb3
...
@@ -342,12 +342,13 @@ class Webservice_model extends CI_Model {
...
@@ -342,12 +342,13 @@ class Webservice_model extends CI_Model {
}
}
}
}
$mechanic_id
=
$data
[
'mechanic_id'
];
$mechanic_id
=
$data
[
'mechanic_id'
];
$sql
=
"SELECT ISS.*, IC.*, MI.
*
$sql
=
"SELECT ISS.*, IC.*, MI.
mechanic_id, MI.custom_description, MI.custom_service_fee
FROM issues_category AS IC
FROM issues_category AS IC
INNER JOIN issues AS ISS ON (IC.issue_id=ISS.issue_id)
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
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')
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
)"
;
WHERE ISS.status='1' AND IC.status='1' AND IC.issue_cat_id IN (
$issue_cat_id
)"
;
$subIssData
=
$this
->
db
->
query
(
$sql
);
$subIssData
=
$this
->
db
->
query
(
$sql
);
$sIssueData
=
array
();
$sIssueData
=
array
();
if
(
!
empty
(
$subIssData
)
&&
!
empty
(
$subIssData
=
$subIssData
->
result_array
())){
if
(
!
empty
(
$subIssData
)
&&
!
empty
(
$subIssData
=
$subIssData
->
result_array
())){
...
...
application/views/Bookings/list-booking.php
View file @
155eecb3
...
@@ -119,9 +119,15 @@
...
@@ -119,9 +119,15 @@
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>
<button
class=
"btn btn-sm btn-primary"
style=
"margin-top:3px;"
booking_id=
"
<?=
encode_param
(
$bookData
->
booking_id
)
?>
"
id=
"customQuote"
>
<?php
if
(
$bookData
->
custom_id
==
''
){
?>
<i
class=
"fa fa-fw fa-edit"
></i>
Generate Custom Quote
<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>
</button>
<?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>
<?php
}
?>
</td>
</td>
</tr>
</tr>
<?php
}
}
?>
<?php
}
}
?>
...
...
assets/js/custom-script.js
View file @
155eecb3
...
@@ -756,8 +756,20 @@ function viewMapIssueDetails(issue_id) {
...
@@ -756,8 +756,20 @@ function viewMapIssueDetails(issue_id) {
return
false
;
return
false
;
}
}
jQuery
(
'[id="customQuote"]'
).
on
(
'click'
,
function
(){
jQuery
(
'[id="customQuote"]'
).
on
(
'click'
,
function
()
{
var
booking_id
=
jQuery
(
this
).
attr
(
'booking_id'
);
var
thisObj
=
jQuery
(
this
);
if
(
thisObj
.
attr
(
'view'
)
==
'0'
){
customQuote
(
thisObj
);
}
else
{
viewCustomQuote
(
thisObj
);
}
});
quoteThisObj
=
''
;
function
customQuote
(
thisObj
){
quoteThisObj
=
thisObj
;
var
booking_id
=
thisObj
.
attr
(
'booking_id'
);
if
(
booking_id
==
''
||
booking_id
==
undefined
||
booking_id
==
'undefined'
||
booking_id
==
null
||
booking_id
==
'null'
){
if
(
booking_id
==
''
||
booking_id
==
undefined
||
booking_id
==
'undefined'
||
booking_id
==
null
||
booking_id
==
'null'
){
return
true
;
return
true
;
...
@@ -846,7 +858,7 @@ jQuery('[id="customQuote"]').on('click',function(){
...
@@ -846,7 +858,7 @@ jQuery('[id="customQuote"]').on('click',function(){
jQuery
(
'[id="modal_content"]'
).
html
(
'Something went wrong, please try again later...!'
);
jQuery
(
'[id="modal_content"]'
).
html
(
'Something went wrong, please try again later...!'
);
}
}
})
})
}
)
}
function
submitCustQuote
(
e
){
function
submitCustQuote
(
e
){
e
.
preventDefault
();
e
.
preventDefault
();
...
@@ -884,6 +896,7 @@ function submitCustQuote(e){
...
@@ -884,6 +896,7 @@ function submitCustQuote(e){
if
(
form_data
==
''
||
form_data
==
undefined
||
form_data
==
'undefined'
||
form_data
==
null
||
form_data
==
'null'
){
if
(
form_data
==
''
||
form_data
==
undefined
||
form_data
==
'undefined'
||
form_data
==
null
||
form_data
==
'null'
){
return
true
;
return
true
;
}
}
jQuery
.
ajax
({
jQuery
.
ajax
({
url
:
base_url
+
"Bookings/insertCustomQuote"
,
url
:
base_url
+
"Bookings/insertCustomQuote"
,
type
:
'POST'
,
type
:
'POST'
,
...
@@ -904,6 +917,9 @@ function submitCustQuote(e){
...
@@ -904,6 +917,9 @@ function submitCustQuote(e){
return
false
;
return
false
;
}
}
else
{
else
{
quoteThisObj
.
attr
(
'view'
,
'1'
);
quoteThisObj
.
find
(
'span'
).
html
(
'View Custom Quote'
);
quoteThisObj
.
attr
(
'booking_id'
,
resp_data
[
'data'
]);
remModalLoader
();
remModalLoader
();
jQuery
(
'[id="modal_content"]'
).
html
(
'Custom Quote Inserted Successfully.'
);
jQuery
(
'[id="modal_content"]'
).
html
(
'Custom Quote Inserted Successfully.'
);
return
false
;
return
false
;
...
@@ -920,6 +936,95 @@ function submitCustQuote(e){
...
@@ -920,6 +936,95 @@ function submitCustQuote(e){
})
})
}
}
function
viewCustomQuote
(
thisObj
){
var
custom_id
=
thisObj
.
attr
(
'booking_id'
);
if
(
custom_id
==
''
||
custom_id
==
undefined
||
custom_id
==
'undefined'
||
custom_id
==
null
||
custom_id
==
'null'
){
return
true
;
}
modalTrigger
(
'View Custom Description'
,
''
);
addModalLoader
();
jQuery
.
ajax
({
url
:
base_url
+
"Bookings/getCustomData"
,
type
:
'POST'
,
data
:
{
'custom_id'
:
custom_id
,
'view_all'
:
'1'
},
success
:
function
(
resp
){
if
(
resp
==
''
||
resp
==
undefined
||
resp
==
'undefined'
||
resp
==
null
||
resp
==
'null'
){
remModalLoader
();
jQuery
(
'[id="modal_content"]'
).
html
(
'Something went wrong, please try again later...!'
);
return
false
;
}
var
resp_data
=
jQuery
.
parseJSON
(
resp
);
if
(
resp_data
[
'status'
]
==
'0'
){
remModalLoader
();
jQuery
(
'[id="modal_content"]'
).
html
(
'Something went wrong, please try again later...!'
);
return
false
;
}
var
booking_data
=
resp_data
[
'data'
];
jQuery
.
each
(
booking_data
,
function
(
index
,
value
){
if
(
value
==
''
||
value
==
null
||
value
==
'null'
||
value
==
undefined
||
value
==
'undefined'
){
booking_data
[
index
]
=
' -- '
;
}
});
var
html
=
''
,
imgCount
=
0
,
issueHtml
=
''
,
optionalHtml
=
''
,
issues_selected
=
jQuery
.
parseJSON
(
booking_data
[
'issues_selected'
]),
custdescription
=
jQuery
.
parseJSON
(
booking_data
[
'custom_service_quote'
]);
// console.log(custdescription);
if
(
issues_selected
!=
''
){
var
comma
=
''
;
issueHtml
+=
'<div class="col-md-12" style="padding-top:10px">'
+
'<div class="col-md-4"><div class="row"><label>Selected Issue</label></div></div>'
+
'<div class="col-md-4"><div class="row"><label>Description</label></div></div>'
+
'<div class="col-md-4"><div class="row"><label>Amount</label></div></div>'
+
'<div class="row">'
;
jQuery
.
each
(
issues_selected
,
function
(
index
,
value
)
{
issueHtml
+=
'<div class="col-md-12">'
+
'<div class="col-md-4 marginTop10">'
;
issueHtml
+=
comma
+
' '
+
value
[
'issue_category'
]
+
' '
;
issueHtml
+=
'</div>'
+
'<div class="col-md-4 marginTop10">'
+
custdescription
[
index
][
'description'
]
+
'</div>'
+
'<div class="col-md-4 marginTop10">'
+
custdescription
[
index
][
'amount'
]
+
'</div>'
+
'</div>'
;
});
issueHtml
+=
'</div>'
+
'</div>'
+
'<div class="col-md-12">'
+
'<div class="col-md-6"></div>'
+
'<div class="col-md-6"><br><br>'
+
'<div class="col-md-4"><label>Total Amount</label></div>'
+
'<div class="col-md-1">:</div>'
+
'<div class="col-md-5"><b>'
+
booking_data
[
'custom_amount'
]
+
'</b></div>'
+
'</div>'
+
'</div>'
;
}
remModalLoader
();
jQuery
(
'[id="modal_content"]'
).
html
(
issueHtml
);
jQuery
(
'[id^="optionalImage_"]'
).
error
(
function
()
{
jQuery
(
'[id^="optionalImage_"]'
).
attr
(
'src'
,
base_url
+
'assets/images/no_image_text.png'
);
});
},
fail
:
function
(
xhr
,
textStatus
,
errorThrown
){
remModalLoader
();
jQuery
(
'[id="modal_content"]'
).
html
(
'Something went wrong, please try again later...!'
);
},
error
:
function
(
ajaxContext
)
{
remModalLoader
();
jQuery
(
'[id="modal_content"]'
).
html
(
'Something went wrong, please try again later...!'
);
}
})
}
jQuery
(
'[id="showBookinDetails"]'
).
on
(
'click'
,
function
()
{
jQuery
(
'[id="showBookinDetails"]'
).
on
(
'click'
,
function
()
{
var
booking_id
=
jQuery
(
this
).
attr
(
'booking_id'
);
var
booking_id
=
jQuery
(
this
).
attr
(
'booking_id'
);
...
...
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