Staging #1663

Merged
korina.cordero merged 16 commits from staging into master 2023-02-09 10:19:34 +00:00
6 changed files with 66 additions and 41 deletions
Showing only changes of commit 6e9e56b1be - Show all commits

View file

@ -47,6 +47,10 @@ class GenerateBatteryCompatibilityCommand extends Command
$comp_batt = [];
foreach ($batteries as $battery)
{
// check if battery is active
if (!($battery->isActive()))
continue;
// set to the first compatible battery found until a more expensive one is found
$comp_batt['id'] = $battery->getID();
$comp_batt['name'] = $battery->getModel()->getName() . ' ' .

View file

@ -826,20 +826,24 @@ class APIController extends Controller implements LoggedController
$batts = $vehicle->getBatteries();
foreach ($batts as $batt)
{
// TODO: Add warranty_tnv to battery information
$batt_list[] = [
'id' => $batt->getID(),
'mfg_id' => $batt->getManufacturer()->getID(),
'mfg_name' => $batt->getManufacturer()->getName(),
'model_id' => $batt->getModel()->getID(),
'model_name' => $batt->getModel()->getName(),
'size_id' => $batt->getSize()->getID(),
'size_name' => $batt->getSize()->getName(),
'price' => $batt->getSellingPrice(),
'wty_private' => $batt->getWarrantyPrivate(),
'wty_commercial' => $batt->getWarrantyCommercial(),
'image_url' => $this->getBatteryImageURL($req, $batt),
];
// check if battery is active
if ($batt->isActive())
{
// TODO: Add warranty_tnv to battery information
$batt_list[] = [
'id' => $batt->getID(),
'mfg_id' => $batt->getManufacturer()->getID(),
'mfg_name' => $batt->getManufacturer()->getName(),
'model_id' => $batt->getModel()->getID(),
'model_name' => $batt->getModel()->getName(),
'size_id' => $batt->getSize()->getID(),
'size_name' => $batt->getSize()->getName(),
'price' => $batt->getSellingPrice(),
'wty_private' => $batt->getWarrantyPrivate(),
'wty_commercial' => $batt->getWarrantyCommercial(),
'image_url' => $this->getBatteryImageURL($req, $batt),
];
}
}
// data

View file

@ -48,20 +48,24 @@ class BatteryController extends APIController
$batts = $vehicle->getBatteries();
foreach ($batts as $batt)
{
// TODO: Add warranty_tnv to battery information
$batt_list[] = [
'id' => $batt->getID(),
'mfg_id' => $batt->getManufacturer()->getID(),
'mfg_name' => $batt->getManufacturer()->getName(),
'model_id' => $batt->getModel()->getID(),
'model_name' => $batt->getModel()->getName(),
'size_id' => $batt->getSize()->getID(),
'size_name' => $batt->getSize()->getName(),
'price' => $batt->getSellingPrice(),
'wty_private' => $batt->getWarrantyPrivate(),
'wty_commercial' => $batt->getWarrantyCommercial(),
'image_url' => $this->getBatteryImageURL($req, $batt),
];
// check if battery is active
if ($batt->isActive())
{
// TODO: Add warranty_tnv to battery information
$batt_list[] = [
'id' => $batt->getID(),
'mfg_id' => $batt->getManufacturer()->getID(),
'mfg_name' => $batt->getManufacturer()->getName(),
'model_id' => $batt->getModel()->getID(),
'model_name' => $batt->getModel()->getName(),
'size_id' => $batt->getSize()->getID(),
'size_name' => $batt->getSize()->getName(),
'price' => $batt->getSellingPrice(),
'wty_private' => $batt->getWarrantyPrivate(),
'wty_commercial' => $batt->getWarrantyCommercial(),
'image_url' => $this->getBatteryImageURL($req, $batt),
];
}
}
// data

View file

@ -497,17 +497,21 @@ class VehicleController extends Controller
// get compatible batteries from selected manufacturer
foreach ($vobj->getBatteries() as $battery)
{
$batteries[] = [
'id' => $battery->getID(),
'mfg_name' => $battery->getManufacturer()->getName(),
'model_name' => $battery->getModel()->getName(),
'size_name' => $battery->getSize()->getName(),
'prod_code' => $battery->getProductCode(),
'sell_price' => $battery->getSellingPrice(),
'warr_private' => $battery->getWarrantyPrivate(),
'warr_commercial' => $battery->getWarrantyCommercial(),
];
$battery_index[$battery->getID()] = 1;
// need to check if battery is active
if ($battery->isActive())
{
$batteries[] = [
'id' => $battery->getID(),
'mfg_name' => $battery->getManufacturer()->getName(),
'model_name' => $battery->getModel()->getName(),
'size_name' => $battery->getSize()->getName(),
'prod_code' => $battery->getProductCode(),
'sell_price' => $battery->getSellingPrice(),
'warr_private' => $battery->getWarrantyPrivate(),
'warr_commercial' => $battery->getWarrantyCommercial(),
];
$battery_index[$battery->getID()] = 1;
}
}
// add all other batteries, because they want options

View file

@ -714,7 +714,7 @@ class ResqRiderAPIHandler implements RiderAPIHandlerInterface
if (isset($data['error']))
return $data;
$batts = $this->em->getRepository(Battery::class)->findAll();
$batts = $this->em->getRepository(Battery::class)->findBy(['flag_active' => true]);
$models = $this->em->getRepository(BatteryModel::class)->findAll();
$sizes = $this->em->getRepository(BatterySize::class)->findAll();

View file

@ -239,7 +239,8 @@ $(function() {
manufacturer: "{{ batt.getManufacturer.getName|default('') }} ",
model: "{{ batt.getModel.getName|default('') }}",
size: "{{ batt.getSize.getName|default('') }}",
sell_price: "{{ batt.getSellingPrice }}"
sell_price: "{{ batt.getSellingPrice }}",
flag_active: "{{ batt.isActive }}"
};
battRows.push(trow);
@ -341,6 +342,14 @@ $(function() {
layout: {
scroll: true
},
rows: {
beforeTemplate: function(row, data, index) {
var is_active = data.flag_active;
if (is_active == false) {
$(row).addClass('hide');
}
}
},
columns: [
{
field: 'id',