Commit 4534bb0d by Ajil

garege chng

parent 185ecdd5
...@@ -206,7 +206,9 @@ foreach($result as $value){ ...@@ -206,7 +206,9 @@ foreach($result as $value){
public function getGarage_QuoteData($request_id){ public function getGarage_QuoteData($request_id){
$sql = "SELECT garage_response.*,garage_request.request_code FROM garage_response LEFT JOIN garage_request on garage_request.id = garage_response.req_id WHERE garage_response.req_id=$request_id Order by garage_response.id DESC"; $sql = "SELECT garage_response.*,garage_request.request_code FROM garage_response
LEFT JOIN garage_request on garage_request.id = garage_response.req_id
WHERE garage_response.req_id=$request_id Order by garage_response.id DESC";
......
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
quote_data[index] = ' -- '; quote_data[index] = ' -- ';
} }
}); });
var html = '<table id="DataTables_Table_0" class="table table-striped table-bordered dataTable-custom dataTable" data-ajax="Garage_request/get_all_Garage_request" role="grid" aria-describedby="DataTables_Table_0_info">'+ var html = '<table id="DataTables_Table_0" class="table table-striped table-bordered dataTable-custom dataTable" role="grid" aria-describedby="DataTables_Table_0_info">'+
'<thead>'+ '<thead>'+
'<tr role="row">'+ '<tr role="row">'+
'<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2" style="width: 200px;" aria-label="Request Code: activate to sort column ascending">Request Code:'+ quote_data['posReq_id']+'</th>'+ '<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2" style="width: 200px;" aria-label="Request Code: activate to sort column ascending">Request Code:'+ quote_data['posReq_id']+'</th>'+
...@@ -133,11 +133,11 @@ ...@@ -133,11 +133,11 @@
'</tr>'+ '</tr>'+
'</tbody>'+ '</tbody>'+
'</table>'+ '</table>'+
'<table id="DataTables_Table_0" class="table table-striped table-bordered dataTable-custom dataTable" data-ajax="Garage_request/get_all_Garage_request" role="grid" aria-describedby="DataTables_Table_0_info">'+ '<table id="DataTables_Table_0" class="table table-striped table-bordered dataTable-custom dataTable" role="grid" aria-describedby="DataTables_Table_0_info">'+
'<thead>'+ '<thead>'+
'<tr role="row">'+ '<tr role="row">'+
'<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2" style="width: 200px;" aria-label="Request Code: activate to sort column ascending">Customer Details</th>'+ '<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2" style="width: 200px;" aria-label="Request Code: activate to sort column ascending">Customer Details</th>'+
// '<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2" style="width: 200px;" aria-label="Customer Name: activate to sort column ascending">Vehicle</th>'+
'</tr>'+ '</tr>'+
'</thead>'+ '</thead>'+
'<tbody>'+ '<tbody>'+
......
...@@ -142,7 +142,7 @@ $status = "<button type='button' class='btn btn-info'>Requested</button>"; ...@@ -142,7 +142,7 @@ $status = "<button type='button' class='btn btn-info'>Requested</button>";
$status = "<button type='button' class='btn btn-warning'>Respond</button>"; $status = "<button type='button' class='btn btn-warning'>Respond</button>";
} else if ($r->status == 4) { } else if ($r->status == 4) {
$status = "<button type='button' class='btn'>Quote Send</button>"; $status = "<button type='button' class='btn'>Quote Send To Customer</button>";
} else if ($r->status == 5) { } else if ($r->status == 5) {
$status = "<button type='button' class='btn btn-success'>Approved</button>"; $status = "<button type='button' class='btn btn-success'>Approved</button>";
...@@ -162,9 +162,9 @@ $status = "<button type='button' class='btn btn-danger'>Cancelled</button>"; ...@@ -162,9 +162,9 @@ $status = "<button type='button' class='btn btn-danger'>Cancelled</button>";
<i class='fa fa-cog'></i> Quote <i class='fa fa-cog'></i> Quote
</a>"; </a>";
} }
if ($r->status == 3) { if ($r->status != 2) {
$action .= " <a class='btn btn-sm btn-info' onclick='viewRequestDetails(".$r->id.",".$garage_id.")'> $action .= " <a class='btn btn-sm btn-info' onclick='viewRequestDetails(".$r->id.",".$garage_id.",".$r->status.")'>
<i class='fa fa-cog'></i> VIEW <i class='fa fa-eye'></i> VIEW
</a>"; </a>";
} }
if ($r->status == 5) { if ($r->status == 5) {
...@@ -184,7 +184,7 @@ $assign_dtl = "<a class='btn btn-info btn-sm' href='".base_url()."Garage_request ...@@ -184,7 +184,7 @@ $assign_dtl = "<a class='btn btn-info btn-sm' href='".base_url()."Garage_request
$r->cust_id, $r->cust_id,
$r->request_code, $r->request_code,
$r->customer_name.'<br>'.'<b>'.'Phone:'.'</b>'.($r->phone_no), // $r->customer_name.'<br>'.'<b>'.'Phone:'.'</b>'.($r->phone_no),
$vehicle_dtl, $vehicle_dtl,
$r->service_name, $r->service_name,
$r->booking_date, $r->booking_date,
......
...@@ -237,8 +237,11 @@ $accept = $this->db->update('garage_request',array('status'=>'3'),array('id'=>$r ...@@ -237,8 +237,11 @@ $accept = $this->db->update('garage_request',array('status'=>'3'),array('id'=>$r
public function getGarage_QuoteData($request_id){ public function getGarage_QuoteData($request_id){
$sql = "SELECT garage_response.*,garage_request.request_code FROM garage_response LEFT JOIN garage_request on garage_request.id = garage_response.req_id WHERE garage_response.req_id=$request_id Order by garage_response.id DESC"; $sql = "SELECT garage_response.*,garage_request.request_code,customer.name as customername,customer.phone_no as customerphone,customer.email_id as customeremail,customer.address FROM garage_response
LEFT JOIN garage_request on garage_request.id = garage_response.req_id
LEFT JOIN customer on customer.cust_id = garage_request.cust_id
WHERE garage_response.req_id=$request_id
Order by garage_response.id DESC";
$GarageData = $this->db->query($sql); $GarageData = $this->db->query($sql);
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<tr> <tr>
<th>No</th> <th>No</th>
<td>Request Code</td> <td>Request Code</td>
<th>Customer Name</th> <!-- <th>Customer Name</th> -->
<th>Vehicle Details</th> <th>Vehicle Details</th>
<th>Services</th> <th>Services</th>
<th>Booking Date</th> <th>Booking Date</th>
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<tr> <tr>
<th>No</th> <th>No</th>
<td>Request Code</td> <td>Request Code</td>
<th>Customer Name</th> <!-- <th>Customer Name</th> -->
<th>Vehicle Details</th> <th>Vehicle Details</th>
<th>Services</th> <th>Services</th>
<th>Booking Date</th> <th>Booking Date</th>
...@@ -237,7 +237,7 @@ ...@@ -237,7 +237,7 @@
<script type="text/javascript"> <script type="text/javascript">
function viewRequestDetails(request_id,garage_id){ function viewRequestDetails(request_id,garage_id,status){
if(request_id=='' || request_id==undefined || request_id=='undefined' || request_id==null || request_id=='null'){ if(request_id=='' || request_id==undefined || request_id=='undefined' || request_id==null || request_id=='null'){
return true; return true;
...@@ -253,13 +253,47 @@ function viewRequestDetails(request_id,garage_id){ ...@@ -253,13 +253,47 @@ function viewRequestDetails(request_id,garage_id){
} }
var quote_data = jQuery.parseJSON(resp).data; var quote_data = jQuery.parseJSON(resp).data;
console.log(quote_data);
jQuery.each(quote_data, function (index, value) { jQuery.each(quote_data, function (index, value) {
if(value == '' || value == null || value == undefined || value == 'null' || value == 'undefined'){ if(value == '' || value == null || value == undefined || value == 'null' || value == 'undefined'){
quote_data[index] = ' -- '; quote_data[index] = ' -- ';
} }
}); });
var html = '<table id="DataTables_Table_0" class="table table-striped table-bordered dataTable-custom dataTable" data-ajax="Garage_request/get_all_Garage_request" role="grid" aria-describedby="DataTables_Table_0_info">'+
var html = '';
if(status=='5'){
html += '<table id="DataTables_Table_0" class="table table-striped table-bordered dataTable-custom dataTable" data-ajax="Garage_request/get_all_Garage_request" role="grid" aria-describedby="DataTables_Table_0_info">'+
'<thead>'+
'<tr role="row">'+
'<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2" style="width: 200px;" aria-label="Request Code: activate to sort column ascending">Customer Details</th>'+
'</tr>'+
'</thead>'+
'<tbody>'+
'<tr role="row" class="odd">'+
'<td>Name</td>'+
'<td>'+ quote_data[0]['customername']+'</td>'+
'</tr>'+
'<tr role="row" class="odd">'+
'<td>Phone No</td>'+
'<td>'+ quote_data[0]['customerphone']+'</td>'+
'</tr>'+
'<tr role="row" class="odd">'+
'<td>Email</td>'+
'<td>'+ quote_data[0]['customeremail']+'</td>'+
'</tr>'+
'<tr role="row" class="odd">'+
'<td>Address</td>'+
'<td>'+ quote_data[0]['address']+'</td>'+
'</tr>'+
'</tbody>'+
'</table>';
}
html += '<table id="DataTables_Table_0" class="table table-striped table-bordered dataTable-custom dataTable" data-ajax="Garage_request/get_all_Garage_request" role="grid" aria-describedby="DataTables_Table_0_info">'+
'<thead>'+ '<thead>'+
'<tr role="row">'+ '<tr role="row">'+
...@@ -279,30 +313,35 @@ console.log(quote_data); ...@@ -279,30 +313,35 @@ console.log(quote_data);
for(var i=0; i<quote_data.length; i++) for(var i=0; i<quote_data.length; i++)
{ {
if(quote_data[i]['status']=='1'){}else{} if(quote_data[i]['quote_type']=='1'){$quote_types = "BASE"}
if(quote_data[i]['quote_type']=='2'){$quote_types = "MEDIUM"}
if(quote_data[i]['quote_type']=='3'){$quote_types = "PREMIUM"}
html +='<tr role="row" class="odd">'+ html +='<tr role="row" class="odd">'+
'<td>'+quote_data[i]['quote_code']+'</td>'+ '<td>'+quote_data[i]['quote_code']+'</td>'+
'<td>'+quote_data[i]['quote_type']+'</td>'+ '<td>'+$quote_types+'</td>'+
'<td>'+quote_data[i]['labour_cost']+'</td>'+ '<td>'+quote_data[i]['labour_cost']+'</td>'+
'<td>'+quote_data[i]['parts_cost']+'</td>'+ '<td>'+quote_data[i]['parts_cost']+'</td>'+
'<td>'+quote_data[i]['booking_date']+'</td>'; '<td>'+quote_data[i]['booking_date']+'</td>';
if(quote_data[i]['status']=='1'){ if(quote_data[i]['status']=='1'){
html += '<td> <a class="btn btn-sm btn-primary" >'+
html += '<td> <a class="btn btn-sm btn-success" onclick="viewRequestDetails(2,2)">'+ 'Send To Customer </a></td>';
'<i class="fa fa-cog"></i> Approved </a></td>'; }if(quote_data[i]['status']=='0'){
}else{ html += '<td> <a class="btn btn-sm btn-warning" >'+
html += '<td> <a class="btn btn-sm btn-warning" onclick="viewRequestDetails(2,2)">'+ ' Pending </a></td>';
'<i class="fa fa-cog"></i> Not Approved </a></td>'; } if(quote_data[i]['status']=='2'){
html += '<td> <a class="btn btn-sm btn-success" >'+
' Approved </a></td>';
} }
html += '</tr>'; html += '</tr>';
} }
html += html +=
'</tbody>'+ '</tbody>'+
'</table>'; '</table>';
remModalLoader(); remModalLoader();
jQuery('[id="details"]').html(html); jQuery('[id="details"]').html(html);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment