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:
commit
b51160e9d0
2 changed files with 18 additions and 2 deletions
|
|
@ -254,7 +254,7 @@ class VehicleController extends ApiController
|
||||||
|
|
||||||
// batteries
|
// batteries
|
||||||
$batt_list = [];
|
$batt_list = [];
|
||||||
$batts = $vehicle->getBatteries();
|
$batts = $vehicle->getActiveBatteries();
|
||||||
foreach ($batts as $batt) {
|
foreach ($batts as $batt) {
|
||||||
// TODO: Add warranty_tnv to battery information
|
// TODO: Add warranty_tnv to battery information
|
||||||
$batt_list[] = [
|
$batt_list[] = [
|
||||||
|
|
|
||||||
|
|
@ -233,13 +233,14 @@ $(function() {
|
||||||
var batteryIds = [];
|
var batteryIds = [];
|
||||||
var battMfgModelSize = []
|
var battMfgModelSize = []
|
||||||
|
|
||||||
{% for batt in obj.getActiveBatteries %}
|
{% for batt in obj.getBatteries %}
|
||||||
trow = {
|
trow = {
|
||||||
id: "{{ batt.getID }}",
|
id: "{{ batt.getID }}",
|
||||||
manufacturer: "{{ batt.getManufacturer.getName|default('') }} ",
|
manufacturer: "{{ batt.getManufacturer.getName|default('') }} ",
|
||||||
model: "{{ batt.getModel.getName|default('') }}",
|
model: "{{ batt.getModel.getName|default('') }}",
|
||||||
size: "{{ batt.getSize.getName|default('') }}",
|
size: "{{ batt.getSize.getName|default('') }}",
|
||||||
sell_price: "{{ batt.getSellingPrice }}",
|
sell_price: "{{ batt.getSellingPrice }}",
|
||||||
|
flag_active: {{ batt.isActive ? "true" : "false" }},
|
||||||
};
|
};
|
||||||
|
|
||||||
battRows.push(trow);
|
battRows.push(trow);
|
||||||
|
|
@ -360,6 +361,21 @@ $(function() {
|
||||||
title: 'Model',
|
title: 'Model',
|
||||||
width: 150
|
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',
|
field: 'sell_price',
|
||||||
title: 'Price'
|
title: 'Price'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue