Merge branch '779-fix-battery-recommendations-still-including-inactive-batteries' into 'master'

Display inactive batteries on edit vehicle form, exclude inactive batteries on...

Closes #779

See merge request jankstudio/resq!891
This commit is contained in:
Ramon Gutierrez 2023-12-18 09:18:17 +00:00
commit b51160e9d0
2 changed files with 18 additions and 2 deletions

View file

@ -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[] = [

View file

@ -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 = '<span class="m-badge m-badge--success m-badge--wide">Yes</span>';
} else {
tag = '<span class="m-badge m-badge--danger m-badge--wide">No</span>';
}
return tag;
},
},
{
field: 'sell_price',
title: 'Price'