diff --git a/src/Controller/CustomerAppAPI/VehicleController.php b/src/Controller/CustomerAppAPI/VehicleController.php index bc1e29c2..ba76d7a4 100644 --- a/src/Controller/CustomerAppAPI/VehicleController.php +++ b/src/Controller/CustomerAppAPI/VehicleController.php @@ -254,7 +254,7 @@ class VehicleController extends ApiController // batteries $batt_list = []; - $batts = $vehicle->getBatteries(); + $batts = $vehicle->getActiveBatteries(); foreach ($batts as $batt) { // TODO: Add warranty_tnv to battery information $batt_list[] = [ diff --git a/templates/vehicle/form.html.twig b/templates/vehicle/form.html.twig index 99ecbc0f..e09e275c 100644 --- a/templates/vehicle/form.html.twig +++ b/templates/vehicle/form.html.twig @@ -233,13 +233,14 @@ $(function() { var batteryIds = []; var battMfgModelSize = [] - {% for batt in obj.getActiveBatteries %} + {% for batt in obj.getBatteries %} trow = { id: "{{ batt.getID }}", manufacturer: "{{ batt.getManufacturer.getName|default('') }} ", model: "{{ batt.getModel.getName|default('') }}", size: "{{ batt.getSize.getName|default('') }}", sell_price: "{{ batt.getSellingPrice }}", + flag_active: {{ batt.isActive ? "true" : "false" }}, }; battRows.push(trow); @@ -360,6 +361,21 @@ $(function() { title: 'Model', width: 150 }, + { + field: 'flag_active', + title: 'Active', + template: function (row, index, datatable) { + var tag = ''; + + if (row.flag_active === true) { + tag = 'Yes'; + } else { + tag = 'No'; + } + + return tag; + }, + }, { field: 'sell_price', title: 'Price'