diff --git a/app/Controllers/Jobcard.php b/app/Controllers/Jobcard.php
index 6efdb08..243be8d 100644
--- a/app/Controllers/Jobcard.php
+++ b/app/Controllers/Jobcard.php
@@ -129,6 +129,7 @@ class Jobcard extends BaseController
$jobs=$JobcardModel->where('job_card_id', $job_card_id)->get()->getRowArray();
$data['jobs']=$jobs;
$VehicleModel = new VehicleModel();
+
$vehicles = $VehicleModel->where('isactive',1)->where('vehicle_id',$jobs['vehicle_id'])
->where('branch_id',$this->session->get('logged_user_branch_id'))
->first();
@@ -142,14 +143,15 @@ class Jobcard extends BaseController
$model_name = $BikemodelsModel->where('model_id',$modelId)->select('model_name')->first();
$data['make_model'] = $make_name['make'].' ' . $model_name['model_name'];
// Encode the modelId before searching
- $encodedModelId = json_encode([$modelId]);
+ $encodedModelId = json_encode([$makeId]);
// echo $encodedModelId;die;
// Load the ProductModel
// Query the database to find the product based on make_id and model_id
- $product = $productModel->where('make_id', $makeId)
- ->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
+ $product = $productModel
+ // ->where('make_id', $makeId)
+ ->where('JSON_CONTAINS(make_id, \'' . $encodedModelId . '\')', null, false)
->findAll();
$data['product']=$product;
@@ -236,6 +238,7 @@ class Jobcard extends BaseController
// Insert into the service table
$service['job_card_id'] = $job_card_id;
$service['service_id'] = $item->service_id;
+ $service['labour_cost'] = $item->labour_cost;
$service['qty'] = $item->quality;
$service['tax'] = $item->tax;
$service['amount'] = $item->amount;
@@ -282,6 +285,7 @@ class Jobcard extends BaseController
// Insert into the service table
$service['job_card_id'] = $job_card_id;
$service['complaint_id'] = $item->complaint_id;
+ $service['labour_cost'] = $item->labour_cost;
$service['qty'] = $item->quality;
$service['tax'] = $item->tax;
$service['amount'] = $item->amount;
diff --git a/app/Models/JobcardComplaintModel.php b/app/Models/JobcardComplaintModel.php
index b8e6fad..4266225 100644
--- a/app/Models/JobcardComplaintModel.php
+++ b/app/Models/JobcardComplaintModel.php
@@ -5,5 +5,5 @@ class JobcardComplaintModel extends Model
{
protected $table = 'job_card_complaint';
protected $primaryKey = 'job_card_complaint_id';
- protected $allowedFields = ['job_card_complaint_id','job_card_id','complaint_id','product_id', 'qty', 'tax', 'amount','isactive'];
+ protected $allowedFields = ['job_card_complaint_id','job_card_id','complaint_id', 'labour_cost','product_id', 'qty', 'tax', 'amount','isactive'];
}
\ No newline at end of file
diff --git a/app/Models/JobcardServiceModel.php b/app/Models/JobcardServiceModel.php
index c86ef92..03740f1 100644
--- a/app/Models/JobcardServiceModel.php
+++ b/app/Models/JobcardServiceModel.php
@@ -5,7 +5,7 @@ class JobcardServiceModel extends Model
{
protected $table = 'job_card_service';
protected $primaryKey = 'job_card_service_id';
- protected $allowedFields = ['job_card_service_id', 'job_card_id', 'service_id', 'product_id', 'qty','tax','amount', 'isactive'];
+ protected $allowedFields = ['job_card_service_id', 'job_card_id', 'service_id', 'labour_cost', 'product_id', 'qty','tax','amount', 'isactive'];
}
\ No newline at end of file
diff --git a/app/Views/job_card_form.php b/app/Views/job_card_form.php
index 049507c..46b9d57 100644
--- a/app/Views/job_card_form.php
+++ b/app/Views/job_card_form.php
@@ -107,62 +107,11 @@
Rate |
Tax |
Amount |
- |
+ Action |
|
-
-
-
-
-
- |
-
- |
-
-
- |
-
-
- |
-
-
- |
-
-
- |
-
-
-
- |
- |
-
-
- |
-
-
-
-
-
@@ -356,11 +305,12 @@ $(document).ready(async function() {
'
| ' +
'';
-
+ // console.log(value);
tr = $('#productItemTable tbody').append(newRow);
initializeSelect2();
/** APPEND CHILD PRODUCT */
await edit_product_data(value.product);
+ editlabourcost(value.labour_cost);
}
}
@@ -401,6 +351,7 @@ $(document).ready(async function() {
initializeSelect2();
/** APPEND CHILD PRODUCT */
await edit_product_data(value.product);
+ editlabourcost(value.labour_cost)
}
}
@@ -428,18 +379,34 @@ $(document).ready(async function() {
'';
- $('#productItemTable tbody').append(newRow);
+ $('#productItemTable tbody').append(newRow);
initializeSelect2();
/** APPEND CHILD PRODUCT */
await edit_product_data(value.product);
+ // editlabourcost(value.product)
}
}
+ function editlabourcost(data) {
+ var newRow = ' | | ' +
+ ' | ' +
+ ' | ' +
+ ' | ' +
+ ' | ' +
+ ' | ' +
+ ' | ' +
+ '
';
+
+
+ $('#productItemTable tbody').append(newRow);
+ // $(newRow).insertAfter(tr);
+ initializeSelect2();
+ }
+
function edit_product_data(products) {
for (const product of products) {
- var newRow = `|
- |
+ var newRow = `
|
|