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
839b0156
Commit
839b0156
authored
Aug 06, 2019
by
Jansa Jose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dc
parent
f7c980f4
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
374 additions
and
163 deletions
+374
-163
Product.php
application/controllers/Product.php
+2
-0
Vehicle.php
application/controllers/Vehicle.php
+118
-14
Booking_model.php
application/models/Booking_model.php
+15
-17
Brand_model.php
application/models/Brand_model.php
+7
-7
Customer_model.php
application/models/Customer_model.php
+7
-7
Dashboard_model.php
application/models/Dashboard_model.php
+11
-11
Import_model.php
application/models/Import_model.php
+3
-3
Issue_model.php
application/models/Issue_model.php
+2
-2
Product_model.php
application/models/Product_model.php
+4
-3
Vehicle_model.php
application/models/Vehicle_model.php
+53
-21
add-customer-user.php
application/views/Customer/add-customer-user.php
+30
-21
addproduct.php
application/views/Product/addproduct.php
+5
-5
footer-script.php
application/views/Templates/footer-script.php
+21
-0
addModel.php
application/views/Vehicles/addModel.php
+43
-13
viewModel.php
application/views/Vehicles/viewModel.php
+3
-34
custom-script.js
assets/js/custom-script.js
+50
-5
No files found.
application/controllers/Product.php
View file @
839b0156
...
...
@@ -85,6 +85,7 @@ class Product extends CI_Controller {
redirect
(
base_url
(
'Product/addproduct'
));
}
$_POST
[
'created_by'
]
=
(
$this
->
session
->
userdata
[
'user_type'
]
==
2
)
?
$this
->
session
->
userdata
[
'id'
]
:
0
;
pr
(
$_POST
);
$product_id
=
$this
->
Product_model
->
addProduct
(
$_POST
);
if
(
$product_id
){
$evtMediaData
=
array
();
...
...
@@ -134,6 +135,7 @@ class Product extends CI_Controller {
$template
[
'product_id'
]
=
encode_param
(
$product_id
);
$template
[
'brand_data'
]
=
$this
->
Brand_model
->
getbrand
(
''
,
1
);
$template
[
'product_data'
]
=
$this
->
Product_model
->
getProduct
(
$product_id
);
pr
(
$template
[
'product_data'
]);
$template
[
'veh_data'
][
'make'
]
=
$this
->
Vehicle_model
->
getVehBrand
(
''
,
1
);
$template
[
'product_image'
]
=
$this
->
Product_model
->
getProductImage
(
$product_id
);
$template
[
'brand_id'
]
=
$template
[
'product_data'
]
->
brand_id
;
...
...
application/controllers/Vehicle.php
View file @
839b0156
...
...
@@ -241,7 +241,7 @@ class Vehicle extends CI_Controller {
$template
[
'smenu'
]
=
'View Vehicles Model '
;
$template
[
'pTitle'
]
=
"View Vehicles Model "
;
$template
[
'pDescription'
]
=
"View and Manage Vehicles Models"
;
$template
[
'vehModel_data'
]
=
$this
->
Vehicle_model
->
getVehModel
(
''
,
1
);
//
$template['vehModel_data'] = $this->Vehicle_model->getVehModel('',1);
$this
->
load
->
view
(
'template'
,
$template
);
}
...
...
@@ -266,7 +266,10 @@ class Vehicle extends CI_Controller {
$this
->
session
->
set_flashdata
(
'message'
,
$flashMsg
);
redirect
(
base_url
(
'Vehicle/addVehModel'
));
}
if
(
$err
==
0
&&
(
!
isset
(
$_POST
[
'veh_brand_id'
])
||
empty
(
$_POST
[
'veh_brand_id'
]))){
if
(
$err
==
0
&&
(
!
isset
(
$_POST
[
'vehYear'
])
||
empty
(
$_POST
[
'vehYear'
]))){
$err
=
1
;
$errMsg
=
'Please Select an year'
;
}
else
if
(
$err
==
0
&&
(
!
isset
(
$_POST
[
'veh_brand_id'
])
||
empty
(
$_POST
[
'veh_brand_id'
]))){
$err
=
1
;
$errMsg
=
'Please Select a Brand'
;
}
else
if
(
$err
==
0
&&
(
!
isset
(
$_POST
[
'model'
])
||
empty
(
$_POST
[
'model'
]))){
...
...
@@ -290,9 +293,9 @@ class Vehicle extends CI_Controller {
}
}
public
function
editVehModel
(
$
model
_id
){
public
function
editVehModel
(
$
veh
_id
){
$flashMsg
=
array
(
'message'
=>
'Something went wrong, please try again..!'
,
'class'
=>
'error'
);
if
(
empty
(
$
model_id
)
||
!
is_numeric
(
$model_id
=
decode_param
(
$model
_id
))){
if
(
empty
(
$
veh_id
)
||
!
is_numeric
(
$veh_id
=
decode_param
(
$veh
_id
))){
$this
->
session
->
set_flashdata
(
'message'
,
$flashMsg
);
redirect
(
base_url
(
'Vehicle/viewVehModel'
));
}
...
...
@@ -301,17 +304,19 @@ class Vehicle extends CI_Controller {
$template
[
'smenu'
]
=
'Edit Model'
;
$template
[
'pTitle'
]
=
"Edit Model"
;
$template
[
'pDescription'
]
=
"Update Model Name"
;
$template
[
'
model_id'
]
=
encode_param
(
$model
_id
);
$template
[
'
vehicle_id'
]
=
encode_param
(
$veh
_id
);
$template
[
'vehBrand_data'
]
=
$this
->
Vehicle_model
->
getVehBrand
(
''
,
1
);
$template
[
'vehModel_data'
]
=
$this
->
Vehicle_model
->
getVehModel
(
$model_id
,
1
);
$template
[
'vehModel_data'
]
=
$this
->
Vehicle_model
->
getVehModel
(
''
,
1
);
$template
[
'vehModel_datas'
]
=
$this
->
Vehicle_model
->
getVehModel
(
''
,
1
,
''
,
$veh_id
);
// pr($template['vehModel_datas']);
$this
->
load
->
view
(
'template'
,
$template
);
}
public
function
updateVehModel
(
$
model
_id
=
''
){
public
function
updateVehModel
(
$
vehicle
_id
=
''
){
$err
=
0
;
$errMsg
=
''
;
$flashMsg
=
array
(
'message'
=>
'Something went wrong, please try again..!'
,
'class'
=>
'error'
);
if
(
empty
(
$
model_id
)
||
!
isset
(
$_POST
)
||
empty
(
$_POST
)
||
!
is_numeric
(
decode_param
(
$model
_id
))){
if
(
empty
(
$
vehicle_id
)
||
!
isset
(
$_POST
)
||
empty
(
$_POST
)
||
!
is_numeric
(
decode_param
(
$vehicle
_id
))){
$this
->
session
->
set_flashdata
(
'message'
,
$flashMsg
);
redirect
(
base_url
(
'Vehicle/viewVehModel'
));
}
...
...
@@ -319,7 +324,10 @@ class Vehicle extends CI_Controller {
$this
->
session
->
set_flashdata
(
'message'
,
$flashMsg
);
redirect
(
base_url
(
'Vehicle/addVehModel'
));
}
if
(
$err
==
0
&&
(
!
isset
(
$_POST
[
'veh_brand_id'
])
||
empty
(
$_POST
[
'veh_brand_id'
]))){
if
(
$err
==
0
&&
(
!
isset
(
$_POST
[
'vehYear'
])
||
empty
(
$_POST
[
'vehYear'
]))){
$err
=
1
;
$errMsg
=
'Please Select an year'
;
}
else
if
(
$err
==
0
&&
(
!
isset
(
$_POST
[
'veh_brand_id'
])
||
empty
(
$_POST
[
'veh_brand_id'
]))){
$err
=
1
;
$errMsg
=
'Please Select a Brand'
;
}
else
if
(
$err
==
0
&&
(
!
isset
(
$_POST
[
'model'
])
||
empty
(
$_POST
[
'model'
]))){
...
...
@@ -331,7 +339,7 @@ class Vehicle extends CI_Controller {
$this
->
session
->
set_flashdata
(
'message'
,
$flashMsg
);
redirect
(
base_url
(
'Vehicle/addVehModel'
));
}
$model
=
$this
->
Vehicle_model
->
updateVehModel
(
decode_param
(
$
model
_id
),
$_POST
);
$model
=
$this
->
Vehicle_model
->
updateVehModel
(
decode_param
(
$
vehicle
_id
),
$_POST
);
if
(
$model
){
$flashMsg
=
array
(
'message'
=>
'Successfully Updated Vehicle Model..!'
,
'class'
=>
'success'
);
$this
->
session
->
set_flashdata
(
'message'
,
$flashMsg
);
...
...
@@ -344,12 +352,11 @@ class Vehicle extends CI_Controller {
public
function
getVehModel
(){
$return_arr
=
array
(
'status'
=>
'0'
);
if
(
!
isset
(
$_POST
)
||
empty
(
$_POST
)
||
!
isset
(
$_POST
[
'id'
])
||
empty
(
$_POST
[
'id'
])
||
empty
(
$_POST
[
'id'
])){
if
(
!
isset
(
$_POST
)
||
empty
(
$_POST
)
||
!
isset
(
$_POST
[
'id'
])
||
empty
(
$_POST
[
'id'
])
||
!
isset
(
$_POST
[
'year'
])
||
empty
(
$_POST
[
'year'
])){
echo
json_encode
(
$return_arr
);
exit
;
}
$type
=
(
isset
(
$_POST
[
'type'
])
&&
$_POST
[
'type'
]
==
1
)
?
1
:
0
;
$result
=
$this
->
Vehicle_model
->
getVehModel
(
''
,
1
,
$_POST
[
'id'
]
);
$result
=
$this
->
Vehicle_model
->
getVehModel
(
''
,
1
,
$_POST
);
$results
=
'<option value="-1">No Models</option>'
;
if
(
$result
){
$modArr
=
array
();
...
...
@@ -359,7 +366,7 @@ class Vehicle extends CI_Controller {
continue
;
}
$modArr
[]
=
$model
->
model
;
$results
.=
'<option value="'
.
$model
->
veh_mod
a
l_id
.
'" model="'
.
$model
->
model
.
'">'
;
$results
.=
'<option value="'
.
$model
->
veh_mod
e
l_id
.
'" model="'
.
$model
->
model
.
'">'
;
$results
.=
$model
->
model
;
if
(
$type
==
0
){
$results
.=
(
!
empty
(
$model
->
trim
))
?
' '
.
$model
->
trim
:
''
;
...
...
@@ -370,5 +377,101 @@ class Vehicle extends CI_Controller {
}
echo
$results
;
}
public
function
getVehTrim
(){
$return_arr
=
array
(
'status'
=>
'0'
);
if
(
!
isset
(
$_POST
)
||
empty
(
$_POST
)
||
!
isset
(
$_POST
[
'id'
])
||
empty
(
$_POST
[
'id'
])
||
!
isset
(
$_POST
[
'year'
])
||
empty
(
$_POST
[
'year'
])
||
!
isset
(
$_POST
[
'vehModel'
])
||
empty
(
$_POST
[
'vehModel'
])){
echo
json_encode
(
$return_arr
);
exit
;
}
$result
=
$this
->
Vehicle_model
->
getVehModel
(
$_POST
[
'vehModel'
],
1
,
$_POST
);
$results
=
'<option value="-1">No Trims</option>'
;
if
(
$result
){
$trim
=
array
();
// $results = '<option value="-1">Choose Vehicle Trim</option>';
$results
=
''
;
foreach
(
$result
as
$key
=>
$trim
)
{
if
(
empty
(
$trim
->
trim
)){
unset
(
$result
[
$key
]);
continue
;
}
$results
.=
'<option value="'
.
$trim
->
veh_id
.
'" trim="'
.
$trim
->
trim
.
'">'
.
$trim
->
trim
.
'</option>'
;
}
}
echo
(
!
empty
(
$results
))
?
$results
:
'1'
;
}
public
function
get_all_activity
(){
$data
=
$_GET
;
$columns
=
array
(
"vehicles.year"
,
"vehicles_brand.maker"
,
"vehicle_models.model_name"
,
"vehicles.trim"
,
"vehicles.engine"
,
"vehicles.status"
);
$value
[
'search'
]
=
$data
[
'search'
][
'value'
];
$value
[
'start'
]
=
$data
[
'start'
];
$value
[
'length'
]
=
$data
[
'length'
];
// $search_box = array('bookingId','name','operatorName','travelDate','mobile','amount','payType','Action');
$limit
=
count
(
$data
[
'columns'
]);
$value
[
'where'
]
=
''
;
$where_data
=
array
();
if
(
!
empty
(
$value
[
'search'
]))
{
$where
=
array
();
foreach
(
$columns
as
$c
)
{
$where_data
[]
=
$c
.
" like '%"
.
$value
[
'search'
]
.
"%' "
;
}
$where
=
implode
(
" OR "
,
$where_data
);
$where
=
"("
.
$where
.
")"
;
$value
[
'where'
]
=
$where
;
}
$value
[
'order_type'
]
=
$data
[
'order'
][
0
][
'dir'
];
$activity
=
$this
->
Vehicle_model
->
get_activity
(
$value
);
$all_activity
=
$this
->
Vehicle_model
->
get_activity
();
$filtered
=
count
(
$all_activity
);
if
(
$value
[
'where'
]
!=
''
)
{
$value
[
'length'
]
=
'-1'
;
$page_activity
=
$this
->
Vehicle_model
->
get_activity
(
$value
);
$filtered
=
count
(
$page_activity
);
}
$data
=
array
();
if
(
$activity
)
{
foreach
(
$activity
as
$r
)
{
$edit
=
"<a class='btn btn-sm btn-primary' href=editVehModel/"
.
encode_param
(
$r
->
veh_id
)
.
">
<i class='fa fa-fw fa-edit'></i>Edit
</a>"
;
$del
=
"<a class='btn btn-sm btn-danger' onClick='return doconfirm()'
href=changeModelStatus/"
.
encode_param
(
$r
->
veh_id
)
.
"/2>
<i class='fa fa-fw fa-trash'></i>Delete
</a>"
;
$activate
=
(
$r
->
status
==
'1'
)
?
"<a class='btn btn-sm btn-success' style='background-color:#ac2925' href=changeModelStatus/"
.
encode_param
(
$r
->
veh_id
)
.
"/0>
<i class='fa fa-cog'></i> De-activate
</a>"
:
"<a class='btn btn-sm btn-success' href=changeModelStatus/"
.
encode_param
(
$r
->
veh_id
)
.
"/1>
<i class='fa fa-cog'></i> Activate
</a>"
;
array_push
(
$data
,
array
(
$r
->
year
,
$r
->
maker
,
$r
->
model
,
(
$r
->
trim
!=
''
)
?
$r
->
trim
:
'-'
,
(
$r
->
engine
!=
''
)
?
$r
->
engine
:
'-'
,
(
$r
->
status
==
'1'
)
?
'Active'
:
'De-activate'
,
$edit
.
' '
.
$del
.
' '
.
$activate
));
}
}
echo
json_encode
(
array
(
'recordsFiltered'
=>
$filtered
,
'recordsTotal'
=>
count
(
$all_activity
),
'data'
=>
$data
));
}
}
?>
\ No newline at end of file
application/models/Booking_model.php
View file @
839b0156
...
...
@@ -4,7 +4,7 @@ class Booking_model extends CI_Model {
public
function
_consruct
(){
parent
::
_construct
();
}
//Schedule Booking
public
function
scheduleBooking
(
$postData
=
array
()){
if
(
empty
(
$postData
)
||
!
isset
(
$postData
[
'customer_id'
])
||
empty
(
$postData
[
'customer_id'
])
||
...
...
@@ -15,17 +15,15 @@ class Booking_model extends CI_Model {
return
0
;
}
$vehData
=
$postData
[
'vechile_info'
];
$car_name
=
$vehData
[
'modelYear'
]
.
' '
.
$vehData
[
'maker'
]
.
' '
.
$vehData
[
'modelName'
];
$car_name
=
$vehData
[
'modelYear'
]
.
' '
.
$vehData
[
'maker'
]
.
' '
.
$vehData
[
'modelName'
]
.
' '
.
$vehData
[
'trim'
]
;
$vehJson
=
array
(
'vehicle'
=>
$car_name
,
'attributes'
=>
array
(
'Year'
=>
$vehData
[
'modelYear'
],
'Make'
=>
$vehData
[
'maker'
],
'Trim'
=>
$vehData
[
'trim'
],
'Model'
=>
$vehData
[
'modelName'
],
'Engine'
=>
$vehData
[
'emgine'
]
)
'year'
=>
$vehData
[
'modelYear'
],
'make'
=>
$vehData
[
'maker'
],
'trim'
=>
$vehData
[
'trim'
],
'model'
=>
$vehData
[
'modelName'
],
'engine'
=>
$vehData
[
'emgine'
]
);
$last_date
=
''
;
$last_date
=
NULL
;
if
(
isset
(
$vehData
[
'lastMaintanceDate'
])
&&
!
empty
(
$vehData
[
'lastMaintanceDate'
])){
$last_date
=
$vehData
[
'lastMaintanceDate'
];
}
...
...
@@ -65,7 +63,7 @@ class Booking_model extends CI_Model {
'mileage'
=>
$vehData
[
'milage'
],
'customer_id'
=>
$postData
[
'customer_id'
],
'scheduled_date'
=>
$postData
[
'schedule_date'
][
'date'
],
'scheduled_time'
=>
$postData
[
'schedule_date'
][
'time'
]
,
'scheduled_time'
=>
date
(
'h:i A'
,(
$postData
[
'schedule_date'
][
'time'
])
/
1000
)
,
'issues_selected'
=>
json_encode
(
$selected_issues
),
'customer_veh_id'
=>
$last_id
,
'custom_issue_data'
=>
json_encode
(
$postData
[
'optionalData'
]),
...
...
@@ -90,7 +88,7 @@ class Booking_model extends CI_Model {
}
return
0
;
}
//Get Customer Book Details
function
getCustBookDetails
(
$postData
=
array
(),
$status
=
''
){
$cond
=
array
();
$where_cond
=
array
();
...
...
@@ -151,7 +149,7 @@ class Booking_model extends CI_Model {
}
return
$bookDetails
;
}
//Change Booking status
function
changeBookStatus
(
$customer_id
=
''
,
$booking_id
=
''
,
$status
=
''
){
if
(
empty
(
$customer_id
)
||
empty
(
$booking_id
)
||
$status
==
''
){
return
0
;
...
...
@@ -179,7 +177,7 @@ class Booking_model extends CI_Model {
send_mail
(
$subject
,
$email_id
,
$message
);
return
$status
;
}
//Get Mechanic Bookings
function
getMechBookings
(
$mechanic_id
=
''
,
$booking_id
=
''
,
$status
=
'1'
){
if
(
$this
->
session
->
userdata
(
'user_type'
)
!=
1
&&
empty
(
$mechanic_id
)){
return
0
;
...
...
@@ -239,7 +237,7 @@ class Booking_model extends CI_Model {
}
return
0
;
}
//Change Status
function
changeStatus
(
$booking_id
=
''
,
$status
=
'0'
){
if
(
empty
(
$booking_id
)){
return
0
;
...
...
@@ -274,7 +272,7 @@ class Booking_model extends CI_Model {
}
return
$status
;
}
//Insert Custom Quote
function
insertCustomQuote
(
$data
){
$custData
=
array
();
$total
=
0
;
$book_id
=
decode_param
(
$data
[
'booking_id'
]);
...
...
@@ -300,7 +298,7 @@ class Booking_model extends CI_Model {
}
return
$res
;
}
//Generate Custom Data
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'
);
...
...
application/models/Brand_model.php
View file @
839b0156
...
...
@@ -4,7 +4,7 @@ class Brand_model extends CI_Model {
public
function
_consruct
(){
parent
::
_construct
();
}
//Add Brand
public
function
addBrand
(
$brand_data
=
array
()){
if
(
empty
(
$brand_data
)){
return
0
;
...
...
@@ -12,8 +12,8 @@ class Brand_model extends CI_Model {
$status
=
$this
->
db
->
insert
(
'product_brand'
,
$brand_data
);
return
(
$status
)
?
1
:
0
;
}
function
getBrand
(
$brand_id
=
''
,
$view_all
=
0
){
//Get Brand
public
function
getBrand
(
$brand_id
=
''
,
$view_all
=
0
){
$cond
=
(
$view_all
!=
0
)
?
' status IN (0,1) '
:
' status IN (1) '
;
$cond
.=
(
!
empty
(
$brand_id
))
?
" AND brand_id = '
$brand_id
'"
:
""
;
$result
=
$this
->
db
->
query
(
"SELECT * FROM product_brand WHERE
$cond
"
);
...
...
@@ -22,16 +22,16 @@ class Brand_model extends CI_Model {
}
return
(
empty
(
$brand_id
))
?
$result
->
result
()
:
$result
->
row
();
}
function
changeStatus
(
$brand_id
=
''
,
$status
=
'0'
){
//Change Status
public
function
changeStatus
(
$brand_id
=
''
,
$status
=
'0'
){
if
(
empty
(
$brand_id
)){
return
0
;
}
$status
=
$this
->
db
->
update
(
'product_brand'
,
array
(
'status'
=>
$status
),
array
(
'brand_id'
=>
$brand_id
));
return
$status
;
}
function
updateBrand
(
$brand_id
=
''
,
$brand_data
=
array
()){
//Update Brand
public
function
updateBrand
(
$brand_id
=
''
,
$brand_data
=
array
()){
if
(
empty
(
$brand_id
)
||
empty
(
$brand_data
)){
return
0
;
}
...
...
application/models/Customer_model.php
View file @
839b0156
...
...
@@ -4,7 +4,7 @@ class Customer_model extends CI_Model {
public
function
_consruct
(){
parent
::
_construct
();
}
//Get Customer
function
getCustomer
(
$customer_data
=
array
()){
$cond
=
(
isset
(
$customer_data
[
'phone'
])
&&
!
empty
(
$customer_data
[
'phone'
]))
?
" AND phone LIKE '%"
.
trim
(
$customer_data
[
'phone'
])
.
"'"
:
""
;
...
...
@@ -26,7 +26,7 @@ class Customer_model extends CI_Model {
}
return
$ret_data
;
}
//Create Customer
function
createCustomer
(
$customer_data
=
array
(),
$saved_vehicles
=
array
()){
if
(
empty
(
$customer_data
))
return
0
;
...
...
@@ -63,7 +63,7 @@ class Customer_model extends CI_Model {
$res
=
array
(
'status'
=>
1
,
'data'
=>
''
);
return
(
$status
)
?
1
:
0
;;
}
//Update Customer
function
updateCustomer
(
$customer_id
=
''
,
$customer_data
=
array
(),
$saved_vehicles
=
array
()){
if
(
empty
(
$customer_id
)
||
empty
(
$customer_data
))
return
0
;
...
...
@@ -86,7 +86,7 @@ class Customer_model extends CI_Model {
}
return
(
$status
)
?
1
:
0
;;
}
//Change Status
function
changeStatus
(
$customer_id
=
''
,
$status
=
'0'
){
if
(
empty
(
$customer_id
)){
return
0
;
...
...
@@ -94,11 +94,11 @@ class Customer_model extends CI_Model {
$status
=
$this
->
db
->
update
(
'customers'
,
array
(
'status'
=>
$status
),
array
(
'customer_id'
=>
$customer_id
));
return
$status
;
}
//Check Customer Login
function
checkCustomerLogin
(
$userLogData
){
$respArr
=
array
(
'status'
=>
0
);
if
(
empty
(
$userLogData
)){
return
$re
turnStatus
;
return
$re
spArr
;
}
$result
=
$this
->
db
->
get_where
(
'customers'
,
array
(
'email'
=>
$userLogData
[
'email'
],
'status'
=>
'1'
));
if
(
empty
(
$result
)
||
$result
->
num_rows
()
<
1
||
empty
(
$custData
=
$result
->
row
())){
...
...
@@ -115,7 +115,7 @@ class Customer_model extends CI_Model {
}
return
$respArr
;
}
//Generate Customer Forgot Link
function
genCustForgotPassLink
(
$userLogData
=
array
()){
$respArr
=
array
(
'status'
=>
0
);
if
(
empty
(
$userLogData
)){
...
...
application/models/Dashboard_model.php
View file @
839b0156
...
...
@@ -4,7 +4,7 @@ class Dashboard_model extends CI_Model {
public
function
_consruct
(){
parent
::
_construct
();
}
//Get Booking Count
public
function
getBookingCount
(){
if
(
$this
->
session
->
userdata
(
'user_type'
)
==
1
){
$result
=
$this
->
db
->
get_where
(
'bookings'
)
->
result
();
...
...
@@ -15,7 +15,7 @@ class Dashboard_model extends CI_Model {
}
return
count
(
$result
);
}
//Get Mechanic Shop Count
public
function
getMechShpCount
(){
if
(
$this
->
session
->
userdata
(
'user_type'
)
==
1
){
$result
=
$this
->
db
->
get_where
(
'mechanic_shop'
,
array
(
'status'
=>
'1'
))
->
result
();
...
...
@@ -24,7 +24,7 @@ class Dashboard_model extends CI_Model {
}
return
count
(
$result
);
}
//Get Completed Booking Count
public
function
getCompletedBookingCount
(){
if
(
$this
->
session
->
userdata
(
'user_type'
)
==
1
){
$result
=
$this
->
db
->
get_where
(
'bookings'
,
array
(
'status'
=>
'3'
))
->
result
();
...
...
@@ -35,7 +35,7 @@ class Dashboard_model extends CI_Model {
}
return
count
(
$result
);
}
//Get Pending Booking Count
public
function
getPendingBookingCount
(){
if
(
$this
->
session
->
userdata
(
'user_type'
)
==
1
){
$result
=
$this
->
db
->
get_where
(
'bookings'
,
array
(
'status'
=>
'1'
))
->
result
();
...
...
@@ -46,7 +46,7 @@ class Dashboard_model extends CI_Model {
}
return
count
(
$result
);
}
//Get Mobile Vendors Count
public
function
getMbleVndrsCount
(){
if
(
$this
->
session
->
userdata
(
'user_type'
)
==
1
){
$result
=
$this
->
db
->
get_where
(
'mechanic'
,
array
(
'shop_id'
=>
'1'
))
->
result
();
...
...
@@ -55,7 +55,7 @@ class Dashboard_model extends CI_Model {
}
return
count
(
$result
);
}
//Get Mobile Mechanics Count
public
function
getMbleMchnsCount
(){
if
(
$this
->
session
->
userdata
(
'user_type'
)
==
1
){
$result
=
$this
->
db
->
get_where
(
'mechanic'
,
array
(
'shop_id'
=>
'0'
))
->
result
();
...
...
@@ -64,7 +64,7 @@ class Dashboard_model extends CI_Model {
}
return
count
(
$result
);
}
//Get Customer Count
public
function
getCustomerCount
(){
if
(
$this
->
session
->
userdata
(
'user_type'
)
==
1
){
$result
=
$this
->
db
->
get_where
(
'customers'
,
array
(
'status'
=>
'1'
))
->
result
();
...
...
@@ -73,7 +73,7 @@ class Dashboard_model extends CI_Model {
}
return
count
(
$result
);
}
//Get Product Count
public
function
getProductCount
(){
if
(
$this
->
session
->
userdata
(
'user_type'
)
==
1
){
$result
=
$this
->
db
->
get_where
(
'products'
,
array
(
'status'
=>
'1'
))
->
result
();
...
...
@@ -83,7 +83,7 @@ class Dashboard_model extends CI_Model {
}
return
count
(
$result
);
}
//Get Product Sold Count
public
function
getProductSoldCount
(){
if
(
$this
->
session
->
userdata
(
'user_type'
)
==
1
){
$result
=
$this
->
db
->
query
(
"SELECT SUM(`quantity`) as count FROM `orders` WHERE status IN('2,3,4,5')"
)
->
row
();
...
...
@@ -93,7 +93,7 @@ class Dashboard_model extends CI_Model {
}
return
$result
->
count
;
}
//Get Sales Report Count
public
function
getSalesReportCount
(){
$query
=
$this
->
db
->
query
(
"
SELECT COUNT(ORDS.order_id) AS count, SUBSTRING_INDEX(TRANS.datetime, '-', 1) AS year
...
...
@@ -110,7 +110,7 @@ class Dashboard_model extends CI_Model {
}
return
json_encode
(
$result
);
}
//Get booking Report Count
public
function
getBookingReportCount
(){
$query
=
$this
->
db
->
query
(
"
SELECT COUNT(BUK.booking_id) AS count, SUBSTRING_INDEX(TRANS.datetime, '-', 1) AS year
...
...
application/models/Import_model.php
View file @
839b0156
...
...
@@ -4,7 +4,7 @@ class Import_model extends CI_Model {
public
function
_consruct
(){
parent
::
_construct
();
}
//Check Brand
public
function
checkBrand
(
$brand
){
$result
=
$this
->
db
->
get_where
(
'product_brand'
,
array
(
'brand_name'
=>
$brand
));
if
(
empty
(
$result
)
||
$result
->
num_rows
()
<
0
||
empty
(
$result
=
$result
->
row_array
())){
...
...
@@ -13,7 +13,7 @@ class Import_model extends CI_Model {
}
return
$result
[
'brand_id'
];
}
//Check Card Details
public
function
checkCardetails
(
$year
,
$brand
,
$model
){
$brandData
=
$this
->
db
->
get_where
(
'vehicles_brand'
,
array
(
'maker'
=>
$brand
));
if
(
empty
(
$brandData
)
||
$brandData
->
num_rows
()
<
0
||
empty
(
$brandData
=
$brandData
->
row_array
())){
...
...
@@ -32,7 +32,7 @@ class Import_model extends CI_Model {
}
return
$carData
[
'id'
];
}
//Add Product
public
function
addProduct
(
$new
=
array
()){
if
(
$this
->
db
->
insert
(
'products'
,
$new
)){
return
1
;
...
...
application/models/Issue_model.php
View file @
839b0156
...
...
@@ -4,7 +4,7 @@ class Issue_model extends CI_Model {
public
function
_consruct
(){
parent
::
_construct
();
}
//Add Issue
public
function
addIssue
(
$issue_data
=
array
(),
$issueTyp
=
array
()){
if
(
empty
(
$issue_data
)
||
empty
(
$issueTyp
))
return
0
;
...
...
@@ -18,7 +18,7 @@ class Issue_model extends CI_Model {
$status
=
$this
->
db
->
insert_batch
(
'issues_category'
,
$issueTyp
);
return
(
$status
)
?
1
:
0
;
}
//Get Issues
function
getIssues
(
$issue_id
=
''
,
$view_all
=
0
){
$cond
=
(
$view_all
!=
0
)
?
' ISS.status IN (0,1) '
:
' ISS.status IN (1) '
;
$cond
.=
(
!
empty
(
$issue_id
))
?
" AND ISS.issue_id = '
$issue_id
' "
:
""
;
...
...
application/models/Product_model.php
View file @
839b0156
...
...
@@ -16,7 +16,7 @@ class Product_model extends CI_Model {
$status
=
$this
->
db
->
insert
(
'products'
,
$product_data
);
$last_id
=
$this
->
db
->
insert_id
();
foreach
(
$prdYear
as
$key
=>
$value
)
{
$this
->
db
->
insert
(
'product_cars'
,
array
(
'product_id'
=>
$last_id
,
'veh_model_id'
=>
$prdVehModel
[
$key
]
,
'year'
=>
$value
));
$this
->
db
->
insert
(
'product_cars'
,
array
(
'product_id'
=>
$last_id
,
'veh_model_id'
=>
$prdVehModel
[
$key
]));
}
return
$last_id
;
}
...
...
@@ -34,10 +34,11 @@ class Product_model extends CI_Model {
if
(
!
empty
(
$product_id
)){
$result
=
$result
->
row
();
$sql
=
"SELECT PC.prd_car_id,PC.year,VM.model
,VM.trim,VM.engine,VB.maker,VM.veh_modal
_id
$sql
=
"SELECT PC.prd_car_id,PC.year,VM.model
_name as model,VEH.trim,VEH.engine,VB.maker,VM.veh_model_id,VEH.veh
_id
FROM products AS PRD
LEFT JOIN product_cars AS PC ON (PRD.product_id=PC.product_id AND PC.status='1')
LEFT JOIN vehicles_model AS VM ON (PC.veh_model_id=VM.veh_modal_id AND VM.status='1')
LEFT JOIN vehicles AS VEH ON (PC.veh_model_id=VEH.veh_id AND VEH.status='1')
LEFT JOIN vehicles_model AS VM ON (VM.veh_model_id=VEH.veh_id AND VM.status='1')
LEFT JOIN vehicles_brand AS VB ON (VB.veh_brand_id=VM.veh_brand_id AND VB.status='1')
WHERE PC.product_id='
$product_id
' AND PRD.status='1'"
;
$carData
=
$this
->
db
->
query
(
$sql
);
...
...
application/models/Vehicle_model.php
View file @
839b0156
...
...
@@ -41,12 +41,13 @@ class Vehicle_model extends CI_Model {
if
(
!
empty
(
$vehData
)){
$vehData
=
$vehData
->
result
();
foreach
(
$vehData
as
$key
=>
$value
)
{
$result
=
$this
->
db
->
query
(
"SELECT VEHM.veh_brand_id,VEHM.veh_modal_id
FROM vehicles_model AS VEHM
WHERE VEHM.model='"
.
$value
->
car_model
.
"'"
)
->
row
();
$result
=
$this
->
db
->
query
(
"SELECT VEH.veh_brand_id,VEH.model_id
FROM vehicles AS VEH
INNER JOIN vehicle_models AS VEHM ON VEHM.veh_model_id = VEH.model_id
WHERE VEHM.model_name='"
.
$value
->
car_model
.
"'"
)
->
row
();
if
(
!
empty
(
$result
)){
$vehData
[
$key
]
->
veh_brand_id
=
$result
->
veh_brand_id
;
$vehData
[
$key
]
->
veh_model_id
=
$result
->
veh_moda
l_id
;
$vehData
[
$key
]
->
veh_model_id
=
$result
->
mode
l_id
;
}
}
return
$vehData
;
...
...
@@ -95,7 +96,7 @@ class Vehicle_model extends CI_Model {
return
0
;
}
if
(
$type
==
'2'
){
$status
=
$this
->
db
->
update
(
'vehicles
_model'
,
array
(
'status'
=>
$status
),
array
(
'veh_modal
_id'
=>
$brand_id
));
$status
=
$this
->
db
->
update
(
'vehicles
'
,
array
(
'status'
=>
$status
),
array
(
'veh
_id'
=>
$brand_id
));
}
else
{
$status
=
$this
->
db
->
update
(
'vehicles_brand'
,
array
(
'status'
=>
$status
),
array
(
'veh_brand_id'
=>
$brand_id
));
}
...
...
@@ -111,42 +112,73 @@ class Vehicle_model extends CI_Model {
}
function
getVehModel
(
$veh_model_id
=
''
,
$view_all
=
0
,
$veh_brand_id
=
''
){
$cond
=
(
$view_all
!=
0
)
?
' vehicles_model.status IN (0,1) '
:
' vehicles_model.status IN (1) '
;
$cond
.=
(
!
empty
(
$veh_model_id
))
?
" AND vehicles_model.veh_modal_id = '
$veh_model_id
'"
:
""
;
$cond
.=
(
!
empty
(
$veh_brand_id
))
?
" AND vehicles_model.veh_brand_id = '
$veh_brand_id
'"
:
""
;
$result
=
$this
->
db
->
query
(
"SELECT vehicles_model.*, vehicles_brand.maker
FROM vehicles_model
JOIN vehicles_brand ON vehicles_brand.veh_brand_id = vehicles_model.veh_brand_id
WHERE
$cond
ORDER BY vehicles_model.model"
);
function
getVehModel
(
$veh_model_id
=
''
,
$view_all
=
0
,
$vehData
=
array
(),
$veh_id
=
''
){
$cond
=
(
$view_all
!=
0
)
?
' vehicles.status IN (0,1) '
:
' vehicles.status IN (1) '
;
$cond
.=
(
!
empty
(
$veh_model_id
))
?
" AND vehicles.model_id = '
$veh_model_id
'"
:
""
;
$cond
.=
(
!
empty
(
$vehData
[
'id'
]))
?
" AND vehicles.veh_brand_id = '"
.
$vehData
[
'id'
]
.
"'"
:
""
;
$cond
.=
(
!
empty
(
$vehData
[
'year'
]))
?
" AND vehicles.year = '"
.
$vehData
[
'year'
]
.
"'"
:
""
;
$cond
.=
(
!
empty
(
$veh_id
))
?
" AND vehicles.veh_id = '"
.
$veh_id
.
"'"
:
""
;
$result
=
$this
->
db
->
query
(
"SELECT vehicles.*,vehicles_brand.maker,vehicle_models.model_name AS model,vehicle_models.veh_model_id
FROM vehicles
JOIN vehicles_brand ON vehicles_brand.veh_brand_id = vehicles.veh_brand_id
JOIN vehicle_models ON vehicle_models.veh_model_id = vehicles.model_id
WHERE
$cond
ORDER BY model"
);
if
(
empty
(
$result
)){
return
;
}
if
(
isset
(
$veh
_brand_id
)
&&
!
empty
(
$veh_brand_id
)){
if
(
isset
(
$veh
Data
[
'id'
])
&&
!
empty
(
$vehData
[
'id'
]
)){
return
$result
->
result
();
}
if
(
isset
(
$veh_id
)
&&
!
empty
(
$veh_id
)){
return
$result
->
row
();
}
return
(
empty
(
$veh_model_id
))
?
$result
->
result
()
:
$result
->
row
();
}
function
get_activity
(
$filter
=
null
){
if
(
$filter
)
{
if
(
$filter
[
'length'
]
!=-
1
)
$this
->
db
->
limit
(
$filter
[
'length'
],
$filter
[
'start'
]);
$this
->
db
->
order_by
(
"model"
,
$filter
[
'order_type'
]);
if
(
!
empty
(
$filter
[
'where'
]))
{
$this
->
db
->
where
(
$filter
[
'where'
]);
}
}
$this
->
db
->
select
(
'vehicles.*,vehicles_brand.maker,vehicle_models.model_name AS model'
);
$this
->
db
->
from
(
'vehicles'
);
$this
->
db
->
join
(
'vehicles_brand'
,
'vehicles_brand.veh_brand_id = vehicles.veh_brand_id'
);
$this
->
db
->
join
(
'vehicle_models'
,
'vehicle_models.veh_model_id = vehicles.model_id'
);
$this
->
db
->
where
(
'vehicles.status !='
,
'2'
);
$query
=
$this
->
db
->
get
();
if
(
!
empty
(
$query
)
&&
!
empty
(
$query
=
$query
->
result
())){
return
$query
;
}
return
0
;
}
public
function
addModel
(
$veh_data
=
array
()){
if
(
empty
(
$veh_data
)){
return
0
;
}
$result
=
$this
->
db
->
get_where
(
'vehicles_model'
,
array
(
'vehicles_model.model'
=>
$veh_data
[
'model'
],
'vehicles_model.veh_brand_id'
=>
$veh_data
[
'veh_brand_id'
]))
->
row
();
$trim
=
(
isset
(
$veh_data
[
'trim'
])
&&
!
empty
(
$veh_data
[
'trim'
]))
?
$veh_data
[
'trim'
]
:
''
;
$engine
=
(
isset
(
$veh_data
[
'engine'
])
&&
!
empty
(
$veh_data
[
'engine'
]))
?
$veh_data
[
'engine'
]
:
''
;
$result
=
$this
->
db
->
get_where
(
'vehicles'
,
array
(
'vehicles.model_id'
=>
$veh_data
[
'model'
],
'vehicles.veh_brand_id'
=>
$veh_data
[
'veh_brand_id'
],
'vehicles.trim'
=>
$trim
,
'vehicles.engine'
=>
$engine
,
'vehicles.year'
=>
$veh_data
[
'vehYear'
]))
->
row
();
if
(
$result
){
return
0
;
}
$status
=
$this
->
db
->
insert
(
'vehicles_model'
,
$veh_data
);
$last_id
=
$this
->
db
->
insert_id
(
);
return
$last_id
;
$status
=
$this
->
db
->
insert
(
"vehicles"
,
array
(
'veh_brand_id'
=>
$veh_data
[
'veh_brand_id'
],
'year'
=>
$veh_data
[
'vehYear'
],
'model_id'
=>
$veh_data
[
'model'
],
'trim'
=>
$trim
,
'engine'
=>
$engine
)
);
return
(
$status
)
?
1
:
0
;
}
public
function
updateVehModel
(
$
model
_id
=
''
,
$model_data
=
array
()){
if
(
empty
(
$
model
_id
)
||
empty
(
$model_data
)){
public
function
updateVehModel
(
$
vehicle
_id
=
''
,
$model_data
=
array
()){
if
(
empty
(
$
vehicle
_id
)
||
empty
(
$model_data
)){
return
0
;
}
$status
=
$this
->
db
->
update
(
'vehicles
_model'
,
$model_data
,
array
(
'veh_modal_id'
=>
$model
_id
));
$status
=
$this
->
db
->
update
(
'vehicles
'
,
array
(
'veh_brand_id'
=>
$model_data
[
'veh_brand_id'
],
'year'
=>
$model_data
[
'vehYear'
],
'model_id'
=>
$model_data
[
'model'
],
'trim'
=>
(
isset
(
$model_data
[
'trim'
])
&&
!
empty
(
$model_data
[
'trim'
]))
?
$model_data
[
'trim'
]
:
''
,
'engine'
=>
(
isset
(
$model_data
[
'engine'
])
&&
!
empty
(
$model_data
[
'engine'
]))
?
$model_data
[
'engine'
]
:
''
),
array
(
'veh_id'
=>
$vehicle
_id
));
return
(
$status
)
?
1
:
0
;
}
...
...
application/views/Customer/add-customer-user.php
View file @
839b0156
...
...
@@ -149,6 +149,21 @@
<div
id=
"searchTyp_1"
>
<div
class=
"col-md-12"
>
<div
class=
"col-md-6"
>
<label>
Vehicle Model Year
</label>
<select
name=
"vehYear"
class=
"form-control required"
input=
"search_params"
data-parsley-trigger=
"change"
required=
""
onchange=
"setYear()"
>
<option
selected
disabled
value=
""
>
Choose Vehicle Model Year
</option>
<?php
for
(
$year
=
date
(
'Y'
);
$year
>=
1950
;
$year
--
){
$cond
=
(
isset
(
$vehicle_data
)
&&
isset
(
$vehicle_data
->
model
)
&&
!
empty
(
$vehicle_data
->
model
)
&&
$vehicle_data
->
model
==
$year
)
?
'selected'
:
''
;
echo
'<option '
.
$cond
.
' value="'
.
$year
.
'">'
.
$year
.
'</option>'
;
}
?>
</select>
</div>
<div
class=
"col-md-6"
>
<label>
Vehicle Maker
</label>
<select
name=
"vehMaker"
class=
"form-control required"
data-parsley-trigger=
"change"
required=
""
id=
"veh_make"
input=
"search_params"
type=
"1"
>
<option
selected
disabled
value=
""
>
Choose Vehicle Make
</option>
...
...
@@ -159,10 +174,12 @@
?>
</select>
</div>
</div>
<div
class=
"col-md-12 padTop10 hide"
id=
"vehicle_model_div"
>
<div
class=
"col-md-6"
>
<label>
Vehicle Model
</label>
<select
name=
"vehModel"
class=
"form-control required"
data-parsley-trigger=
"change"
required=
""
id=
"veh_model"
input=
"search_params"
>
<option
selected
=
""
disabled=
""
value=
""
>
Choose Vehicle Model
</option>
<option
selected
disabled
value=
""
>
Choose Vehicle Model
</option>
<?php
if
((
isset
(
$customer_id
)
||
!
empty
(
$customer_id
))){
foreach
(
$veh_data
[
'model'
]
as
$key
=>
$value
)
{
...
...
@@ -172,40 +189,32 @@
?>
</select>
</div>
</div>
<div
class=
"col-md-12 padTop10"
>
<div
class=
"col-md-6"
>
<label>
Vehicle Model Year
</label>
<select
name=
"vehYear"
class=
"form-control required"
input=
"search_params"
data-parsley-trigger=
"change"
required=
""
>
<option
selected
disabled
value=
""
>
Choose Vehicle Model Year
</option>
<?php
for
(
$year
=
date
(
'Y'
);
$year
>=
1950
;
$year
--
){
$cond
=
(
isset
(
$vehicle_data
)
&&
isset
(
$vehicle_data
->
model
)
&&
!
empty
(
$vehicle_data
->
model
)
&&
$vehicle_data
->
model
==
$year
)
?
'selected'
:
''
;
echo
'<option '
.
$cond
.
' value="'
.
$year
.
'">'
.
$year
.
'</option>'
;
<div
class=
"col-md-6 hide"
id=
"vehicle_trim_div"
>
<label>
Trim
</label>
<select
name=
"trim"
class=
"form-control"
data-parsley-trigger=
"change"
id=
"veh_trim"
input=
"search_params"
>
<option
selected
disabled
value=
"-1"
>
Choose Vehicle Trim
</option>
<?php
if
((
isset
(
$customer_id
)
||
!
empty
(
$customer_id
))){
foreach
(
$veh_data
[
'model'
]
as
$key
=>
$value
)
{
echo
'<option value="'
.
$value
->
trim
.
'">'
.
$value
->
trim
.
'</option>'
;
}
}
?>
</select>
</div>
</div>
<div
class=
"col-md-12 padTop10"
>
<div
class=
"col-md-6"
>
<label>
Vehicle Location
</label>
<input
type=
"text"
class=
"form-control required"
name=
"vehLocationDetails"
id=
"loc_search_1"
input=
"search_params"
placeholder=
"Enter Vehicle Location"
required
>
</div>
</div>
<div
class=
"col-md-12 padTop10"
>
<div
class=
"col-md-6"
>
<label>
Engine
</label>
<input
type=
"text"
class=
"form-control"
name=
"engine"
id=
"engine"
input=
"search_params"
placeholder=
"Enter Vehicle Engine"
>
</div>
<div
class=
"col-md-6"
>
<label>
Trim
</label>
<input
type=
"text"
class=
"form-control"
name=
"trim"
id=
"trim"
input=
"search_params"
placeholder=
"Enter Vehicle Trim"
>
</div>
</div>
</div>
<!-- Vehicle Details Search END -->
...
...
application/views/Product/addproduct.php
View file @
839b0156
...
...
@@ -162,11 +162,11 @@
<?php
if
((
isset
(
$product_id
)
||
!
empty
(
$product_id
))){
foreach
(
$veh_data
[
'model'
]
as
$key
=>
$value
)
{
$cond
=
(
isset
(
$product_data
)
&&
isset
(
$product_data
->
veh_mod
a
l_id
)
&&
!
empty
(
$product_data
->
veh_mod
a
l_id
)
&&
$product_data
->
veh_mod
al_id
==
$value
->
veh_moda
l_id
)
?
'selected'
:
''
;
$cond
=
(
isset
(
$product_data
)
&&
isset
(
$product_data
->
veh_mod
e
l_id
)
&&
!
empty
(
$product_data
->
veh_mod
e
l_id
)
&&
$product_data
->
veh_mod
el_id
==
$value
->
veh_mode
l_id
)
?
'selected'
:
''
;
echo
'<option '
.
$cond
.
' value="'
.
$value
->
veh_mod
a
l_id
.
'">'
.
$value
->
model
.
' '
.
$value
->
trim
.
' '
.
$value
->
engine
.
'</option>'
;
echo
'<option '
.
$cond
.
' value="'
.
$value
->
veh_mod
e
l_id
.
'">'
.
$value
->
model
.
' '
.
$value
->
trim
.
' '
.
$value
->
engine
.
'</option>'
;
}
}
?>
...
...
@@ -210,7 +210,7 @@
</div>
</div>
<input
type=
"hidden"
value=
"
<?=
$value
->
year
?>
"
name=
"prdVehYear[]"
>
<input
type=
"hidden"
value=
"
<?=
$value
->
veh_
modal_
id
?>
"
name=
"prdVehModel[]"
>
<input
type=
"hidden"
value=
"
<?=
$value
->
veh_id
?>
"
name=
"prdVehModel[]"
>
</span>
</div>
<?php
...
...
application/views/Templates/footer-script.php
View file @
839b0156
...
...
@@ -65,6 +65,26 @@
"ordering"
:
jQuery
(
this
)
.
data
(
"ordering"
),
"order"
:
[[
0
,
"desc"
]]
});
var
schedulingGrid
=
$
(
'.dataTable-custom'
)
.
DataTable
({
/*"ordering" : $(this).data("ordering"),
"order": [[ 0, "desc" ]],*/
"processing"
:
true
,
"serverSide"
:
true
,
"ajax"
:
"<?php echo base_url(); ?>"
+
$
(
this
)
.
data
(
"ajax"
),
"iDisplayLength"
:
10
,
"aLengthMenu"
:
[
[
10
,
25
,
50
,
-
1
],
[
10
,
25
,
50
,
"All"
]
],
"columnDefs"
:
[{
"targets"
:
[
],
"visible"
:
false
,
"searchable"
:
false
}]
});
var
table
=
$
(
'#activity_table'
)
.
DataTable
();
});
<?
php
//} ?>
</
script
>
\ No newline at end of file
application/views/Vehicles/addModel.php
View file @
839b0156
...
...
@@ -11,7 +11,7 @@
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<?php
$url
=
(
!
isset
(
$
model_id
)
||
empty
(
$model_id
))
?
'Vehicle/createModel'
:
'Vehicle/updateVehModel/'
.
$model
_id
;
$url
=
(
!
isset
(
$
vehicle_id
)
||
empty
(
$vehicle_id
))
?
'Vehicle/createModel'
:
'Vehicle/updateVehModel/'
.
$vehicle
_id
;
if
(
$this
->
session
->
flashdata
(
'message'
))
{
$flashdata
=
$this
->
session
->
flashdata
(
'message'
);
?>
<div
class=
"alert alert-
<?=
$flashdata
[
'class'
]
?>
"
>
...
...
@@ -25,16 +25,34 @@
<div
class=
"box-body"
>
<form
role=
"form"
action=
"
<?=
base_url
(
$url
)
?>
"
method=
"post"
class=
"validate"
data-parsley-validate=
""
enctype=
"multipart/form-data"
>
<div
class=
"col-md-6"
>
<div
class=
"col-md-4"
>
<div
class=
"form-group"
>
<label>
Vehicle Model Year
</label>
<select
name=
"vehYear"
class=
"form-control required"
input=
"search_params"
data-parsley-trigger=
"change"
required=
""
onchange=
"setYear()"
>
<option
selected
disabled
value=
""
>
Choose Vehicle Model Year
</option>
<?php
for
(
$year
=
date
(
'Y'
);
$year
>=
1950
;
$year
--
){
$cond
=
(
isset
(
$vehModel_datas
)
&&
isset
(
$vehModel_datas
->
year
)
&&
!
empty
(
$vehModel_datas
->
year
)
&&
$vehModel_datas
->
year
==
$year
)
?
'selected'
:
''
;
echo
'<option '
.
$cond
.
' value="'
.
$year
.
'">'
.
$year
.
'</option>'
;
}
?>
</select>
<span
class=
"glyphicon form-control-feedback"
></span>
</div>
</div>
<div
class=
"col-md-4"
>
<div
class=
"form-group"
>
<label>
Select Brand
</label>
<select
name=
"veh_brand_id"
class=
"form-control required"
placeholder=
"Select Brand"
required=
"
"
>
<option
selected
disabled
>
Choose a Brand
</option>
<select
name=
"veh_brand_id"
id=
"veh_make"
class=
"form-control required"
placeholder=
"Select Brand"
required=
""
type=
"1
"
>
<option
selected
disabled
value=
"-1"
>
Choose a Brand
</option>
<?php
foreach
(
$vehBrand_data
as
$brand
)
{
$select
=
(
isset
(
$vehModel_data
->
veh_brand_id
)
&&
$brand
->
veh_brand_id
==
$vehModel_data
->
veh_brand_id
)
?
'selected'
:
''
;
echo
'<option '
.
$select
.
' value="'
.
$brand
->
veh_brand_id
.
'">'
.
$select
=
(
isset
(
$vehModel_data
s
->
veh_brand_id
)
&&
$brand
->
veh_brand_id
==
$vehModel_data
s
->
veh_brand_id
)
?
'selected'
:
''
;
echo
'<option '
.
$select
.
' value="'
.
$brand
->
veh_brand_id
.
'"
maker="'
.
$brand
->
veh_brand_id
.
'"
>'
.
$brand
->
maker
.
'</option>'
;
}
...
...
@@ -43,26 +61,38 @@
<span
class=
"glyphicon form-control-feedback"
></span>
</div>
</div>
<div
class=
"col-md-6"
>
<?php
$text
=
(
isset
(
$vehModel_datas
->
veh_model_id
)
&&
!
empty
(
$vehModel_datas
->
veh_model_id
))
?
''
:
'hide'
;
?>
<div
class=
"col-md-4
<?php
echo
$text
?>
"
id=
"vehicle_model_div"
>
<div
class=
"form-group"
>
<label>
Model Name
</label>
<input
type=
"text"
class=
"form-control required"
data-parsley-trigger=
"change"
data-parsley-minlength=
"2"
data-parsley-pattern=
"^[a-zA-Z0-9\ . _ - ' \/]+$"
name=
"model"
required=
""
value=
"
<?=
(
isset
(
$vehModel_data
->
model
))
?
$vehModel_data
->
model
:
''
?>
"
placeholder=
"Enter Vehicle Model"
>
<select
name=
"model"
class=
"form-control required "
placeholder=
"Select Model"
required=
""
id=
"veh_model"
>
<option
selected
disabled
>
Choose a Model
</option>
<?php
foreach
(
$vehModel_data
as
$model
)
{
$select
=
(
isset
(
$vehModel_datas
->
veh_model_id
)
&&
$model
->
veh_model_id
==
$vehModel_datas
->
veh_model_id
)
?
'selected'
:
''
;
echo
'<option '
.
$select
.
' value="'
.
$model
->
veh_model_id
.
'">'
.
$model
->
model
.
'</option>'
;
}
?>
</select>
<span
class=
"glyphicon form-control-feedback"
></span>
</div>
</div>
<div
class=
"col-md-6"
>
<div
class=
"form-group"
>
<label>
Trim
</label>
<input
type=
"text"
class=
"form-control required"
name=
"trim"
required=
""
value=
"
<?=
(
isset
(
$vehModel_data
->
trim
))
?
$vehModel_data
->
trim
:
''
?>
"
placeholder=
"Enter Vehicle Trim"
>
<input
type=
"text"
class=
"form-control required"
name=
"trim"
required=
""
value=
"
<?=
(
isset
(
$vehModel_data
s
->
trim
))
?
$vehModel_datas
->
trim
:
''
?>
"
placeholder=
"Enter Vehicle Trim"
>
<span
class=
"glyphicon form-control-feedback"
></span>
</div>
</div>
<div
class=
"col-md-6"
>
<div
class=
"form-group"
>
<label>
Engine
</label>
<input
type=
"text"
class=
"form-control required"
name=
"engine"
required=
""
value=
"
<?=
(
isset
(
$vehModel_data
->
engine
))
?
$vehModel_data
->
engine
:
''
?>
"
placeholder=
"Enter Vehicle Engine"
>
<input
type=
"text"
class=
"form-control required"
name=
"engine"
required=
""
value=
"
<?=
(
isset
(
$vehModel_data
s
->
engine
))
?
$vehModel_datas
->
engine
:
''
?>
"
placeholder=
"Enter Vehicle Engine"
>
<span
class=
"glyphicon form-control-feedback"
></span>
</div>
</div>
...
...
application/views/Vehicles/viewModel.php
View file @
839b0156
...
...
@@ -28,10 +28,10 @@
</div>
</div>
<div
class=
"box-body"
>
<table
id=
"mechanicUsers"
class=
"table table-bordered table-striped datatable
"
>
<table
class=
"table table-bordered table-striped dataTable-custom"
data-ajax=
"get_all_activity"
data-ordering=
"true"
id=
"activity_table
"
>
<thead>
<tr>
<th
class=
"hidden"
>
ID
</th>
<th
width=
"90px;"
>
Vehicle Year
</th>
<th
width=
"150px;"
>
Vehicle Brand
</th>
<th
width=
"150px;"
>
Vehicle Model
</th>
<th
width=
"150px;"
>
Trim
</th>
...
...
@@ -40,38 +40,7 @@
<th
width=
"300px;"
>
Action
</th>
</tr>
</thead>
<tbody>
<?php
if
(
!
empty
(
$vehModel_data
)){
foreach
(
$vehModel_data
as
$model
)
{
?>
<tr>
<th
class=
"hidden"
>
<?=
$model
->
veh_modal_id
?>
</th>
<th
class=
"center"
>
<?=
$model
->
maker
?>
</th>
<th
class=
"center"
>
<?=
$model
->
model
?>
</th>
<th
class=
"center"
>
<?=
$model
->
trim
?>
</th>
<th
class=
"center"
>
<?=
$model
->
engine
?>
</th>
<th
class=
"center"
>
<?=
(
$model
->
status
==
1
)
?
'Active'
:
'De-activate'
?>
</th>
<td
class=
"center"
>
<a
class=
"btn btn-sm btn-primary"
href=
"
<?=
base_url
(
'Vehicle/editVehModel/'
.
encode_param
(
$model
->
veh_modal_id
))
?>
"
>
<i
class=
"fa fa-fw fa-edit"
></i>
Edit
</a>
<a
class=
"btn btn-sm btn-danger"
href=
"
<?=
base_url
(
"Vehicle/changeModelStatus/"
.
encode_param
(
$model
->
veh_modal_id
))
.
"/2"
?>
"
onClick=
"return doconfirm()"
>
<i
class=
"fa fa-fw fa-trash"
></i>
Delete
</a>
<?php
if
(
$model
->
status
==
1
){
?>
<a
class=
"btn btn-sm btn-success"
style=
"background-color:#ac2925"
href=
"
<?=
base_url
(
"Vehicle/changeModelStatus/"
.
encode_param
(
$model
->
veh_modal_id
))
.
"/0"
?>
"
>
<i
class=
"fa fa-cog"
></i>
De-activate
</a>
<?php
}
else
{
?>
<a
class=
"btn btn-sm btn-success"
href=
"
<?=
base_url
(
"Vehicle/changeModelStatus/"
.
encode_param
(
$model
->
veh_modal_id
))
.
"/1"
?>
"
>
<i
class=
"fa fa-cog"
></i>
Activate
</a>
<?php
}
?>
</td>
</tr>
<?php
}
}
?>
</tbody>
<tbody></tbody>
</table>
</div>
</div>
...
...
assets/js/custom-script.js
View file @
839b0156
...
...
@@ -13,6 +13,25 @@ function setImg(input,id) {
}
}
function
setYear
(){
var
vehModel
=
jQuery
(
'[name="vehModel"] option:selected'
).
val
(),
vehMake
=
jQuery
(
'[name="vehMaker"] option:selected'
).
attr
(
'maker'
),
vehTrim
=
jQuery
(
'[name="trim"] option:selected'
).
val
();
if
(
vehMake
!=
''
||
vehMake
!=
undefined
||
vehMake
!=
'undefined'
||
vehMake
!=
null
||
vehMake
!=
'null'
||
vehModel
!=
''
||
vehModel
!=
undefined
||
vehModel
!=
'undefined'
||
vehModel
!=
null
||
vehModel
!=
'null'
||
vehTrim
!=
''
||
vehTrim
!=
undefined
||
vehTrim
!=
'undefined'
||
vehTrim
!=
null
||
vehTrim
!=
'null'
){
jQuery
(
'[id="vehicle_model_div"]'
).
addClass
(
'hide'
);
jQuery
(
'[id="vehicle_trim_div"]'
).
addClass
(
'hide'
);
jQuery
(
'[id="veh_make"]'
).
val
(
''
);
jQuery
(
'[id="veh_model"]'
).
val
(
''
);
jQuery
(
'[id="veh_trim"]'
).
val
(
''
);
}
else
if
(
vehMake
!=
''
||
vehMake
!=
undefined
||
vehMake
!=
'undefined'
||
vehMake
!=
null
||
vehMake
!=
'null'
||
vehModel
!=
''
||
vehModel
!=
undefined
||
vehModel
!=
'undefined'
||
vehModel
!=
null
||
vehModel
!=
'null'
){
jQuery
(
'[id="vehicle_model_div"]'
).
addClass
(
'hide'
);
jQuery
(
'[id="veh_make"]'
).
val
(
''
);
jQuery
(
'[id="veh_model"]'
).
val
(
''
);
}
else
if
(
vehMake
!=
''
||
vehMake
!=
undefined
||
vehMake
!=
'undefined'
||
vehMake
!=
null
||
vehMake
!=
'null'
){
jQuery
(
'[id="veh_make"]'
).
val
(
''
);
}
}
function
setMultiImg
(
input
,
thisObj
){
if
(
input
.
files
&&
input
.
files
[
0
])
{
var
reader
=
new
FileReader
();
...
...
@@ -435,14 +454,14 @@ jQuery('[id="vehSearch"]').on('click',function(event) {
return
false
;
}
var
vehVin
=
jQuery
(
'[name="vehVin"]'
).
val
(),
vehTrim
=
jQuery
(
'[
id="trim"]'
).
val
(
),
vehTrim
=
jQuery
(
'[
name="trim"] option:selected'
).
attr
(
'trim'
),
vehYear
=
jQuery
(
'[name="vehYear"]'
).
val
(),
vehModel
=
jQuery
(
'option:selected'
,
jQuery
(
'[name="vehModel"]'
)).
attr
(
'model'
),
vehMaker
=
jQuery
(
'[name="vehMaker"]'
).
val
(),
vehLocVin
=
jQuery
(
'[name="vehLocationVin"]'
).
val
(),
vehEngine
=
jQuery
(
'[id="engine"]'
).
val
(),
vehLocDetls
=
jQuery
(
'[name="vehLocationDetails"]'
).
val
();
console
.
log
(
vehTrim
);
if
((
searchTypId
==
1
&&
(
vehLocDetls
==
''
||
vehLocDetls
==
null
||
vehLocDetls
==
'null'
||
vehLocDetls
==
undefined
||
vehLocDetls
==
'undefined'
)
&&
(
vehYear
==
''
||
vehYear
==
null
||
vehYear
==
'null'
||
vehYear
==
undefined
||
vehYear
==
'undefined'
||
vehModel
==
''
||
vehModel
==
null
||
vehModel
==
'null'
||
vehModel
==
undefined
||
vehModel
==
'undefined'
||
...
...
@@ -1680,9 +1699,10 @@ function changeOrderStatus(e){
jQuery
(
'#veh_make'
).
on
(
'change'
,
function
()
{
var
id
=
jQuery
(
'option:selected'
,
this
).
attr
(
'maker'
),
type
=
jQuery
(
this
).
attr
(
'type'
);
type
=
jQuery
(
this
).
attr
(
'type'
),
vehYear
=
jQuery
(
'[name="vehYear"]'
).
val
();
if
(
id
==
''
||
id
==
undefined
||
id
==
'undefined'
||
id
==
null
||
id
==
'null'
){
if
(
id
==
''
||
id
==
undefined
||
id
==
'undefined'
||
id
==
null
||
id
==
'null'
||
vehYear
==
''
||
vehYear
==
undefined
||
vehYear
==
'undefined'
||
vehYear
==
null
||
vehYear
==
'null'
){
return
false
;
}
type
=
(
type
==
undefined
||
type
==
'undefined'
||
type
==
null
||
type
==
'null'
||
type
==
''
)?
0
:
type
;
...
...
@@ -1690,14 +1710,39 @@ jQuery('#veh_make').on('change', function () {
jQuery
.
ajax
({
type
:
"POST"
,
url
:
base_url
+
'Vehicle/getVehModel'
,
data
:
'id='
+
id
+
'&type='
+
type
,
data
:
'id='
+
id
+
'&type='
+
type
+
'&year='
+
vehYear
,
success
:
function
(
data
)
{
jQuery
(
'[id="vehicle_model_div"]'
).
removeClass
(
'hide'
);
jQuery
(
'#veh_model'
).
html
(
data
);
remFullScreenLoader
();
}
});
});
jQuery
(
'#veh_model'
).
on
(
'change'
,
function
()
{
jQuery
(
'[id="vehicle_trim_div"]'
).
addClass
(
'hide'
);
var
vehModel
=
jQuery
(
'[name="vehModel"]'
).
val
(),
vehMake
=
jQuery
(
'[name="vehMaker"] option:selected'
).
attr
(
'maker'
),
vehYear
=
jQuery
(
'[name="vehYear"]'
).
val
();
if
(
vehModel
==
''
||
vehModel
==
undefined
||
vehModel
==
'undefined'
||
vehModel
==
null
||
vehModel
==
'null'
||
vehMake
==
''
||
vehMake
==
undefined
||
vehMake
==
'undefined'
||
vehMake
==
null
||
vehMake
==
'null'
||
vehYear
==
''
||
vehYear
==
undefined
||
vehYear
==
'undefined'
||
vehYear
==
null
||
vehYear
==
'null'
){
return
false
;
}
// type = (type == undefined || type == 'undefined' || type == null || type == 'null' || type == '')?0:type;
showFullScreenLoader
();
jQuery
.
ajax
({
type
:
"POST"
,
url
:
base_url
+
'Vehicle/getVehTrim'
,
data
:
'year='
+
vehYear
+
'&id='
+
vehMake
+
'&vehModel='
+
vehModel
,
success
:
function
(
data
)
{
if
(
data
!=
'1'
){
jQuery
(
'[id="vehicle_trim_div"]'
).
removeClass
(
'hide'
);
jQuery
(
'#veh_trim'
).
html
(
data
);
}
remFullScreenLoader
();
}
});
});
jQuery
(
'[id="import_id"]'
).
on
(
'change'
,
function
()
{
var
id
=
jQuery
(
this
).
val
();
if
(
id
!=
''
||
id
!=
undefined
||
id
!=
'undefined'
||
id
!=
null
||
id
!=
'null'
){
...
...
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