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
b6616424
Commit
b6616424
authored
6 years ago
by
Tobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
daily commit
parent
2557a8f3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
85 additions
and
28 deletions
+85
-28
Customer.php
application/controllers/Customer.php
+9
-10
Vehicle.php
application/controllers/Vehicle.php
+4
-0
Customer_model.php
application/models/Customer_model.php
+25
-6
add-customer-user.php
application/views/Customer/add-customer-user.php
+28
-5
list-customer-users.php
application/views/Customer/list-customer-users.php
+7
-7
custom-style.css
assets/css/custom-style.css
+12
-0
custom-script.js
assets/js/custom-script.js
+0
-0
tobin_dcarfixers.sql
sql/tobin_dcarfixers.sql
+0
-0
No files found.
application/controllers/Customer.php
View file @
b6616424
...
...
@@ -91,19 +91,16 @@ class Customer extends CI_Controller {
$upload_data
=
$this
->
upload
->
data
();
$_POST
[
'profile_image'
]
=
$config
[
'upload_path'
]
.
"/"
.
$upload_data
[
'file_name'
];
}
// $_POST['age'] = $this->calculateAge($_POST['date_of_birth']);
// if($_POST['age'] < 0){
// $err = 1;
// $errMsg = 'Provide a valid date of birth';
// }
}
if
(
$err
==
1
){
$flashMsg
[
'message'
]
=
$errMsg
;
$this
->
session
->
set_flashdata
(
'message'
,
$flashMsg
);
redirect
(
base_url
(
'Customer/addCustomerUser'
));
}
$status
=
$this
->
Customer_model
->
createCustomer
(
$_POST
);
$saved_vehicles
=
(
!
empty
(
$_POST
[
'saved_vehicles'
]))
?
implode
(
','
,
$_POST
[
'saved_vehicles'
])
:
''
;
unset
(
$_POST
[
'saved_vehicles'
]);
$status
=
$this
->
Customer_model
->
createCustomer
(
$_POST
,
$saved_vehicles
);
if
(
$status
==
1
){
$flashMsg
[
'class'
]
=
'success'
;
$flashMsg
[
'message'
]
=
'User Created'
;
...
...
@@ -132,7 +129,7 @@ class Customer extends CI_Controller {
public
function
getCustomerData
(){
$return_arr
=
array
(
'status'
=>
'0'
);
if
(
!
isset
(
$_POST
)
||
empty
(
$_POST
)
||
!
isset
(
$_POST
[
'customer_id'
])
||
empty
(
$_POST
[
'customer_id'
])){
if
(
!
isset
(
$_POST
)
||
empty
(
$_POST
)
||!
isset
(
$_POST
[
'customer_id'
])
||
empty
(
$_POST
[
'customer_id'
])){
echo
json_encode
(
$return_arr
);
exit
;
}
$customer_id
=
decode_param
(
$_POST
[
'customer_id'
]);
...
...
@@ -175,7 +172,7 @@ class Customer extends CI_Controller {
$template
[
'customer_id'
]
=
$customer_id
;
$customer_id
=
decode_param
(
$customer_id
);
$template
[
'customer_data'
]
=
$this
->
Customer_model
->
getCustomer
(
array
(
'customer_id'
=>
$customer_id
));
$template
[
'customer_data'
]
=
$this
->
Customer_model
->
getCustomer
(
array
(
'customer_id'
=>
$customer_id
));
$this
->
load
->
view
(
'template'
,
$template
);
}
...
...
@@ -232,8 +229,10 @@ class Customer extends CI_Controller {
$upload_data
=
$this
->
upload
->
data
();
$_POST
[
'profile_image'
]
=
$config
[
'upload_path'
]
.
"/"
.
$upload_data
[
'file_name'
];
}
$saved_vehicles
=
(
!
empty
(
$_POST
[
'saved_vehicles'
]))
?
implode
(
','
,
$_POST
[
'saved_vehicles'
])
:
''
;
unset
(
$_POST
[
'saved_vehicles'
]);
$status
=
$this
->
Customer_model
->
updateCustomer
(
$customerIdDec
,
$_POST
);
$status
=
$this
->
Customer_model
->
updateCustomer
(
$customerIdDec
,
$_POST
,
$saved_vehicles
);
if
(
$status
==
1
){
$flashMsg
[
'class'
]
=
'success'
;
$flashMsg
[
'message'
]
=
'User Details Updated'
;
...
...
This diff is collapsed.
Click to expand it.
application/controllers/Vehicle.php
View file @
b6616424
...
...
@@ -58,6 +58,10 @@ class Vehicle extends CI_Controller {
$return_arr
[
'status'
]
=
3
;
echo
json_encode
(
$return_arr
);
exit
;
}
if
(
$searchType
==
2
){
$vehData
[
'vehicle'
]
=
$vehData
[
'attributes'
][
'Year'
]
.
' '
.
$vehData
[
'attributes'
][
'Make'
]
.
' '
.
$vehData
[
'attributes'
][
'Model'
]
.
' '
.
$vehData
[
'attributes'
][
'Trim'
];
}
$vehicle_data
[
'car_name'
]
=
$vehData
[
'vehicle'
];
$vehicle_data
[
'car_loc_lat'
]
=
$lat_lng
[
'lat'
];
$vehicle_data
[
'car_loc_lng'
]
=
$lat_lng
[
'lng'
];
...
...
This diff is collapsed.
Click to expand it.
application/models/Customer_model.php
View file @
b6616424
...
...
@@ -8,17 +8,27 @@ class Customer_model extends CI_Model {
function
getCustomer
(
$customer_data
=
array
()){
$cond
=
(
isset
(
$customer_data
[
'phone'
])
&&
!
empty
(
$customer_data
[
'phone'
]))
?
" AND phone LIKE '%"
.
trim
(
$customer_data
[
'phone'
])
.
"'"
:
""
;
$cond
.=
(
!
empty
(
$customer_data
[
'customer_id'
]))
?
" AND customer_id = '"
.
trim
(
$customer_data
[
'customer_id'
])
.
"'"
:
""
;
$veh_data
=
array
();
if
(
!
empty
(
$customer_data
[
'customer_id'
])){
$cond
.=
" AND customer_id = '"
.
trim
(
$customer_data
[
'customer_id'
])
.
"'"
;
$veh_data
=
$this
->
db
->
get_where
(
'customer_vehicle'
,
array
(
'status'
=>
'1'
,
'customer_id'
=>
$customer_data
[
'customer_id'
]));
$veh_data
=
(
!
empty
(
$veh_data
))
?
$veh_data
->
result
()
:
''
;
}
$result
=
$this
->
db
->
query
(
"SELECT * FROM customers WHERE status IN (0,1)
$cond
"
);
if
(
empty
(
$result
)){
return
;
}
return
(
empty
(
$customer_data
))
?
$result
->
result
()
:
$result
->
row
();
$ret_data
=
$result
->
result
();
if
(
!
empty
(
$customer_data
)){
$ret_data
=
$result
->
row
();
$ret_data
->
vehicle_data
=
$veh_data
;
}
return
$ret_data
;
}
function
createCustomer
(
$customer_data
=
array
()){
function
createCustomer
(
$customer_data
=
array
()
,
$saved_vehicles
=
array
()
){
if
(
empty
(
$customer_data
))
return
0
;
...
...
@@ -34,12 +44,15 @@ class Customer_model extends CI_Model {
return
3
;
}
}
$status
=
$this
->
db
->
insert
(
'customers'
,
$customer_data
);
if
(
$status
&&
!
empty
(
$saved_vehicles
)
&&
!
empty
(
$cust_id
=
$this
->
db
->
insert_id
())){
$this
->
db
->
query
(
"UPDATE customer_vehicle SET status='1',customer_id='
$cust_id
'
WHERE customer_veh_id IN (
$saved_vehicles
)"
);
}
return
(
$status
)
?
1
:
0
;;
}
function
updateCustomer
(
$customer_id
=
''
,
$customer_data
=
array
()){
function
updateCustomer
(
$customer_id
=
''
,
$customer_data
=
array
()
,
$saved_vehicles
=
array
()
){
if
(
empty
(
$customer_id
)
||
empty
(
$customer_data
))
return
0
;
...
...
@@ -57,6 +70,12 @@ class Customer_model extends CI_Model {
}
$status
=
$this
->
db
->
update
(
'customers'
,
$customer_data
,
array
(
'customer_id'
=>
$customer_id
));
if
(
$status
&&
!
empty
(
$saved_vehicles
)){
$this
->
db
->
query
(
"UPDATE customer_vehicle SET status='1',customer_id='
$customer_id
'
WHERE customer_veh_id IN (
$saved_vehicles
)"
);
}
return
(
$status
)
?
1
:
0
;;
}
...
...
This diff is collapsed.
Click to expand it.
application/views/Customer/add-customer-user.php
View file @
b6616424
...
...
@@ -95,12 +95,34 @@
</div>
</div>
</div>
<div
class=
"col-md-12 padBottom20"
>
<div
class=
"col-md-12 padBottom20"
id=
"savedVehiclesCntr"
>
<div
id=
"savedVehicleBox"
class=
"
<?=
(
!
isset
(
$customer_data
->
vehicle_data
)
||
empty
(
$customer_data
->
vehicle_data
))
?
'hide'
:
''
?>
"
>
<label
style=
"padding-left:30px;"
>
Vehicles Added
</label>
<div
class=
"col-md-12"
>
<div
class=
"col-md-6"
id=
"savedVehiclesCntr"
>
<?php
if
(
isset
(
$customer_data
->
vehicle_data
)
&&
!
empty
(
$customer_data
->
vehicle_data
)){
foreach
(
$customer_data
->
vehicle_data
AS
$vehicle
)
{
?>
<span
id=
"saved_vehicle_
<?=
$vehicle
->
customer_veh_id
?>
"
class=
"vechile-body disp-block marginBottom-5"
>
<i
class=
"fa fa-fw fa-car padRight-8p"
></i>
<?=
$vehicle
->
car_name
?>
<div
id=
"remove_saved_
<?=
$vehicle
->
customer_veh_id
?>
"
car_id=
"
<?=
$vehicle
->
customer_veh_id
?>
"
class=
"float-right"
>
<i
class=
"fa fa-fw fa-close cpoint"
></i>
</div>
<input
type=
"hidden"
name=
"saved_vehicles[]"
value=
"
<?=
$vehicle
->
customer_veh_id
?>
"
>
</span>
<?php
}
}
?>
</div>
</div>
</div>
</form>
</div>
<div
class=
"box-body"
>
<div
class=
"box-header with-border"
>
<h3
class=
"box-title"
>
Add New Vehicles
</h3>
</div>
...
...
@@ -156,7 +178,7 @@
</div>
<div
class=
"col-md-6"
>
<label>
Vehicle Location
</label>
<input
type=
"text"
class=
"form-control required"
name=
"vehLocation"
<input
type=
"text"
class=
"form-control required"
name=
"vehLocation
Details
"
id=
"loc_search_1"
input=
"search_params"
placeholder=
"Enter Vehicle Location"
required
>
</div>
</div>
...
...
@@ -173,7 +195,7 @@
</div>
<div
class=
"col-md-12 padTop10"
>
<label>
Vehicle Location
</label>
<input
type=
"text"
class=
"form-control"
name=
"vehLocation"
<input
type=
"text"
class=
"form-control"
name=
"vehLocation
Vin
"
id=
"loc_search_2"
input=
"search_params"
placeholder=
"Enter Vehicle Location"
>
</div>
</div>
...
...
@@ -195,6 +217,7 @@
<div
class=
"box-footer"
>
<div
style=
"text-align: center;"
>
<button
id=
"createCustomerSubmit"
type=
"submit"
class=
"btn btn-primary"
>
Submit
</button>
<a
href=
"
<?=
base_url
(
'Customer/listCustomerUsers'
)
?>
"
class=
"btn btn-primary"
>
Cancel
</a>
</div>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
application/views/Customer/list-customer-users.php
View file @
b6616424
...
...
@@ -35,13 +35,13 @@
<thead>
<tr>
<th
class=
"hidden"
>
ID
</th>
<th
width=
"1
50px
;"
>
Name
</th>
<th
width=
"
80px
;"
>
Phone
</th>
<th
width=
"1
50px
;"
>
Email ID
</th>
<th
width=
"1
50px
;"
>
Address
</th>
<th
width=
"12
0px
;"
>
Date Of Birth
</th>
<th
width=
"
30px
;"
>
Status
</th>
<th
width=
"
500px
;"
>
Action
</th>
<th
width=
"1
3%
;"
>
Name
</th>
<th
width=
"
10%
;"
>
Phone
</th>
<th
width=
"1
3%
;"
>
Email ID
</th>
<th
width=
"1
4%
;"
>
Address
</th>
<th
width=
"12
%
;"
>
Date Of Birth
</th>
<th
width=
"
5%
;"
>
Status
</th>
<th
width=
"
33%
;"
>
Action
</th>
</tr>
</thead>
<tbody>
...
...
This diff is collapsed.
Click to expand it.
assets/css/custom-style.css
View file @
b6616424
...
...
@@ -328,6 +328,18 @@
padding-right
:
20px
!important
;
}
.padRight10
{
padding-right
:
10px
!important
;
}
.padRight-5p
{
padding-right
:
5%
!important
;
}
.padRight-8p
{
padding-right
:
8%
!important
;
}
.padLeft20
{
padding-left
:
20px
!important
;
}
...
...
This diff is collapsed.
Click to expand it.
assets/js/custom-script.js
View file @
b6616424
This diff is collapsed.
Click to expand it.
sql/tobin_dcarfixers.sql
View file @
b6616424
This diff is collapsed.
Click to expand it.
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