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
416d4fef
Commit
416d4fef
authored
Jan 23, 2019
by
Tobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dc
parent
36cd8466
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
18 deletions
+72
-18
Bookings.php
application/controllers/Bookings.php
+0
-4
Webservices.php
application/controllers/Webservices.php
+32
-5
Booking_model.php
application/models/Booking_model.php
+7
-6
custom-script.js
assets/js/custom-script.js
+33
-3
No files found.
application/controllers/Bookings.php
View file @
416d4fef
...
...
@@ -11,10 +11,6 @@ class Bookings extends CI_Controller {
if
(
!
$this
->
session
->
userdata
(
'logged_in'
))
{
redirect
(
base_url
(
'Login'
));
}
if
(
$this
->
session
->
userdata
[
'user_type'
]
!=
1
){
redirect
(
base_url
());
}
}
public
function
listBookings
(
$mechanic_id
=
''
){
...
...
application/controllers/Webservices.php
View file @
416d4fef
...
...
@@ -231,15 +231,42 @@ class Webservices extends CI_Controller {
// scheduleNow
public
function
scheduleNow
(){
header
(
'Content-type: application/json'
);
$post
=
file_get_contents
(
"php://input"
);
$postData
=
json_decode
(
$post
,
true
);
$postData
=
$_POST
;
$optionalData
=
array
(
'optionlaDescription'
=>
''
,
'optionalImages'
=>
array
(),
'optionalVideos'
=>
array
());
$respArr
=
array
(
'status'
=>
'0'
,
'message'
=>
'Something went wrong.'
);
if
(
empty
(
$postData
)){
echo
json_encode
(
$respArr
);
exit
;
if
(
empty
(
$postData
)
||
empty
(
$postData
=
json_decode
(
$postData
[
'data'
],
true
))
||
!
isset
(
$postData
[
'cost'
])
||
empty
(
$postData
[
'cost'
])
||
!
isset
(
$postData
[
'customer_id'
])
||
empty
(
$postData
[
'customer_id'
])
||
!
isset
(
$postData
[
'mechanic_id'
])
||
empty
(
$postData
[
'mechanic_id'
])
||
!
isset
(
$postData
[
'pickup_data'
])
||
empty
(
$postData
[
'pickup_data'
])
||
!
isset
(
$postData
[
'vechile_info'
])
||
empty
(
$postData
[
'vechile_info'
])
||
!
isset
(
$postData
[
'schedule_date'
])
||
empty
(
$postData
[
'schedule_date'
])
||
!
isset
(
$postData
[
'selected_issues'
])
||
empty
(
$postData
[
'selected_issues'
])){
echo
json_encode
(
$respArr
);
exit
;
}
$optionalData
[
'optionlaDescription'
]
=
(
isset
(
$postData
[
'optionalDescription'
])
&&
!
empty
(
$postData
[
'optionalDescription'
]))
?
$postData
[
'optionalDescription'
]
:
''
;
if
(
isset
(
$_FILES
)
&&
!
empty
(
$_FILES
)){
foreach
(
$_FILES
as
$fileIndex
=>
$optImgs
)
{
if
(
empty
(
$optImgs
)
||
!
isset
(
$optImgs
[
'name'
])
||
empty
(
$optImgs
[
'name'
])){
continue
;
}
$this
->
load
->
library
(
'upload'
);
$config
=
set_upload_service
(
"assets/uploads/services"
);
$config
[
'file_name'
]
=
'optionalImages'
.
$postData
[
'customer_id'
]
.
date
(
'dmYHis'
);
$this
->
upload
->
initialize
(
$config
);
if
(
$this
->
upload
->
do_upload
(
$fileIndex
)){
$upload_data
=
$this
->
upload
->
data
();
$optionalData
[
'optionalImages'
][]
=
$config
[
'upload_path'
]
.
"/"
.
$upload_data
[
'file_name'
];
}
}
}
$this
->
load
->
model
(
'Booking_model'
);
$postData
[
'optionalData'
]
=
$optionalData
;
$status
=
$this
->
Booking_model
->
scheduleBooking
(
$postData
);
if
(
$status
){
$respArr
[
'status'
]
=
'1'
;
...
...
application/models/Booking_model.php
View file @
416d4fef
...
...
@@ -45,16 +45,18 @@ class Booking_model extends CI_Model {
}
if
(
$this
->
db
->
insert
(
'customer_vehicle'
,
$insert_array
)){
$last_id
=
$this
->
db
->
insert_id
();
$book_data
=
array
(
'customer_veh_id'
=>
$last_id
,
$book_data
=
array
(
'cost'
=>
$postData
[
'cost'
],
'mileage'
=>
$vehData
[
'milage'
],
'customer_id'
=>
$postData
[
'customer_id'
],
'mechanic_id'
=>
$postData
[
'mechanic_id'
],
'scheduled_date'
=>
$postData
[
'schedule_date'
][
'date'
],
'scheduled_time'
=>
$postData
[
'schedule_date'
][
'time'
],
'issues_selected'
=>
json_encode
(
$selected_issues
),
'
mileage'
=>
$vehData
[
'milage'
]
,
'c
ost'
=>
$postData
[
'cost'
]
,
'
customer_veh_id'
=>
$last_id
,
'c
ustom_issue_data'
=>
json_encode
(
$postData
[
'optionalData'
])
,
'status'
=>
'0'
);
if
(
$this
->
db
->
insert
(
'bookings'
,
$book_data
)){
...
...
@@ -122,7 +124,7 @@ class Booking_model extends CI_Model {
INNER JOIN customers AS CUST ON (CUST.customer_id AND BK.customer_id)
INNER JOIN admin_users AS ADM ON (ADM.id AND BK.mechanic_id)
INNER JOIN customer_vehicle AS VEH ON (VEH.customer_veh_id AND BK.customer_veh_id)
WHERE
$cond
AND ADM.status='1' AND CUST.status='1'
AND VEH.status='1'
WHERE
$cond
AND ADM.status='1' AND CUST.status='1'
GROUP BY BK.booking_id"
;
$bookData
=
$this
->
db
->
query
(
$sql
);
...
...
@@ -141,4 +143,4 @@ class Booking_model extends CI_Model {
return
$status
;
}
}
?>
\ No newline at end of file
?>
assets/js/custom-script.js
View file @
416d4fef
...
...
@@ -787,8 +787,11 @@ jQuery('[id="showBookinDetails"]').on('click',function() {
booking_data
[
index
]
=
' -- '
;
}
});
var
html
=
''
,
var
html
=
''
,
imgCount
=
0
;
issueHtml
=
''
,
optionalHtml
=
''
,
optional_data
=
jQuery
.
parseJSON
(
booking_data
[
'custom_issue_data'
]),
issues_selected
=
jQuery
.
parseJSON
(
booking_data
[
'issues_selected'
]);
if
(
issues_selected
!=
''
){
...
...
@@ -801,7 +804,30 @@ jQuery('[id="showBookinDetails"]').on('click',function() {
issueHtml
+=
comma
+
' '
+
value
[
'issue_category'
]
+
' '
;
comma
=
','
;
});
issueHtml
+=
'</div></div>'
;
issueHtml
+=
'</div></div><br>'
;
}
if
(
optional_data
!=
''
){
optionalHtml
=
'<div class="col-md-12">'
+
'<div class="row"><label>Additional Information</label></div>'
+
'<div class="row">'
+
'<div class="col-md-2">Issue Details</div>'
+
'<div class="col-md-1">:</div>'
+
'<div class="col-md-9"><label>'
+
optional_data
[
'optionlaDescription'
]
+
'</label></div>'
+
'</div>'
;
if
(
optional_data
[
'optionalImages'
]
!=
''
){
optionalHtml
+=
'<div class="row">'
+
'<div class="col-md-2">Issue Images</div>'
+
'<div class="col-md-1">:</div>'
+
'<div class="col-md-9">'
;
jQuery
.
each
(
optional_data
[
'optionalImages'
],
function
(
index
,
image
)
{
imgCount
+=
1
;
optionalHtml
+=
'<img id="optionalImage_'
+
imgCount
+
'" src="'
+
base_url
+
image
+
'" height="100" width="100" /> '
;
});
optionalHtml
+=
'</div></div>'
;
}
}
html
=
'<div class="col-xs-12">'
+
...
...
@@ -866,11 +892,15 @@ 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> '
+
'</div> '
+
optionalHtml
+
'</div>'
;
remModalLoader
();
jQuery
(
'[id="modal_content"]'
).
html
(
html
);
jQuery
(
'[id^="optionalImage_"]'
).
error
(
function
()
{
jQuery
(
'[id^="optionalImage_"]'
).
attr
(
'src'
,
base_url
+
'assets/images/no_image_text.png'
);
});
},
fail
:
function
(
xhr
,
textStatus
,
errorThrown
){
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