Merge branch '134-white-list-capability-for-cars-for-mobile-app' into 'master'
Resolve "White list capability for cars for mobile app" Closes #134 See merge request jankstudio/resq!120
This commit is contained in:
commit
a8e73e35ab
8 changed files with 100 additions and 10 deletions
|
|
@ -383,7 +383,7 @@ class APIController extends Controller
|
|||
return $res->getReturnResponse();
|
||||
|
||||
// get manufacturer list
|
||||
$mfgs = $em->getRepository(VehicleManufacturer::class)->findBy([], ['name' => 'asc']);
|
||||
$mfgs = $em->getRepository(VehicleManufacturer::class)->findBy(['flag_mobile' => true], ['name' => 'asc']);
|
||||
$mfg_list = [];
|
||||
foreach ($mfgs as $mfg)
|
||||
{
|
||||
|
|
@ -420,7 +420,14 @@ class APIController extends Controller
|
|||
}
|
||||
|
||||
// get makes
|
||||
$vehicles = $mfg->getVehicles();
|
||||
$vehicles = $em->getRepository(Vehicle::class)->findBy(
|
||||
[
|
||||
'flag_mobile' => true,
|
||||
'manufacturer' => $mfg_id,
|
||||
],
|
||||
['make' => 'asc']
|
||||
);
|
||||
// $vehicles = $mfg->getVehicles();
|
||||
$vlist = [];
|
||||
foreach ($vehicles as $v)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ use App\Ramcar\TradeInType;
|
|||
use App\Ramcar\InvoiceStatus;
|
||||
|
||||
use App\Service\InvoiceCreator;
|
||||
use App\Service\MQTTClient;
|
||||
|
||||
use App\Entity\RiderSession;
|
||||
use App\Entity\Customer;
|
||||
|
|
@ -457,7 +458,7 @@ class RAPIController extends Controller
|
|||
$jo->setStatus(JOStatus::IN_TRANSIT);
|
||||
$em->flush();
|
||||
|
||||
// TODO: send mqtt event
|
||||
// TODO: send mqtt event (?)
|
||||
|
||||
// TODO: add event
|
||||
|
||||
|
|
|
|||
|
|
@ -152,6 +152,11 @@ class VehicleController extends BaseController
|
|||
$row->setMake($req->request->get('make'))
|
||||
->setModelYearFrom($req->request->get('model_year_from'))
|
||||
->setModelYearTo($req->request->get('model_year_to'));
|
||||
$flag_mobile = $req->request->get('flag_mobile');
|
||||
if ($flag_mobile)
|
||||
$row->setDisplayMobile(true);
|
||||
else
|
||||
$row->setDisplayMobile(false);
|
||||
|
||||
// initialize error list
|
||||
$error_array = [];
|
||||
|
|
@ -233,6 +238,12 @@ class VehicleController extends BaseController
|
|||
$row->setMake($req->request->get('make'))
|
||||
->setModelYearFrom($req->request->get('model_year_from'))
|
||||
->setModelYearTo($req->request->get('model_year_to'));
|
||||
$flag_mobile = $req->request->get('flag_mobile');
|
||||
if ($flag_mobile)
|
||||
$row->setDisplayMobile(true);
|
||||
else
|
||||
$row->setDisplayMobile(false);
|
||||
|
||||
|
||||
// validate
|
||||
$errors = $validator->validate($row);
|
||||
|
|
|
|||
|
|
@ -141,6 +141,11 @@ class VehicleManufacturerController extends BaseController
|
|||
|
||||
// set and save values
|
||||
$row->setName($req->request->get('name'));
|
||||
$flag_mobile = $req->request->get('flag_mobile');
|
||||
if ($flag_mobile)
|
||||
$row->setDisplayMobile(true);
|
||||
else
|
||||
$row->setDisplayMobile(false);
|
||||
|
||||
// validate
|
||||
$errors = $validator->validate($row);
|
||||
|
|
@ -208,6 +213,11 @@ class VehicleManufacturerController extends BaseController
|
|||
|
||||
// set and save values
|
||||
$row->setName($req->request->get('name'));
|
||||
$flag_mobile = $req->request->get('flag_mobile');
|
||||
if ($flag_mobile)
|
||||
$row->setDisplayMobile(true);
|
||||
else
|
||||
$row->setDisplayMobile(false);
|
||||
|
||||
// validate
|
||||
$errors = $validator->validate($row);
|
||||
|
|
|
|||
|
|
@ -59,10 +59,18 @@ class Vehicle
|
|||
*/
|
||||
protected $batteries;
|
||||
|
||||
// display in mobile app
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $flag_mobile;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->customers = new ArrayCollection();
|
||||
$this->batteries = new ArrayCollection();
|
||||
$this->flag_mobile = true;
|
||||
}
|
||||
|
||||
public function getID()
|
||||
|
|
@ -151,4 +159,15 @@ class Vehicle
|
|||
{
|
||||
return $this->batteries;
|
||||
}
|
||||
|
||||
public function setDisplayMobile($bool = true)
|
||||
{
|
||||
$this->flag_mobile = $bool;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function shouldDisplayMobile()
|
||||
{
|
||||
return $this->flag_mobile;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,9 +34,16 @@ class VehicleManufacturer
|
|||
*/
|
||||
protected $vehicles;
|
||||
|
||||
// display in mobile app
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $flag_mobile;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->vehicles = new ArrayCollection();
|
||||
$this->flag_mobile = true;
|
||||
}
|
||||
|
||||
public function getID()
|
||||
|
|
@ -71,4 +78,15 @@ class VehicleManufacturer
|
|||
{
|
||||
return $this->vehicles;
|
||||
}
|
||||
|
||||
public function setDisplayMobile($bool = true)
|
||||
{
|
||||
$this->flag_mobile = $bool;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function shouldDisplayMobile()
|
||||
{
|
||||
return $this->flag_mobile;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,17 +34,27 @@
|
|||
</div>
|
||||
<form id="row-form" class="m-form m-form--fit m-form--label-align-right m-form--group-seperator-dashed" method="post" action="{{ mode == 'update' ? url('vmfg_update_submit', {'id': obj.getId}) : url('vmfg_create_submit') }}">
|
||||
<div class="m-portlet__body">
|
||||
<div class="form-group m-form__group row">
|
||||
<label class="col-lg-3 col-form-label" data-field="name">
|
||||
Name:
|
||||
</label>
|
||||
<div class="col-lg-9">
|
||||
<input type="text" name="name" class="form-control m-input" value="{{ obj.getName }}">
|
||||
<div class="form-group m-form__group row no-border">
|
||||
<div class="col-lg-12">
|
||||
<label for="name" data-field="name">Name</label>
|
||||
<input type="text" name="name" class="form-control m-input" value="{{ obj.getName() | default('') }}"{{ mode == 'profile' ? ' disabled' }}>
|
||||
<div class="form-control-feedback hide" data-field="name"></div>
|
||||
<span class="m-form__help">Display name for this manufacturer</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row no-border">
|
||||
<div class="col-lg-12">
|
||||
<span class="m-switch m-switch--icon block-switch">
|
||||
<label>
|
||||
<input type="checkbox" name="flag_mobile" id="flag_mobile" value="1"{{ obj.shouldDisplayMobile() ? ' checked' }}>
|
||||
<label class="switch-label">Display in mobile app</label>
|
||||
<span></span>
|
||||
</label>
|
||||
</span>
|
||||
<div class="form-control-feedback hide" data-field="flag_mobile"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="m-portlet__foot m-portlet__foot--fit">
|
||||
<div class="m-form__actions m-form__actions--solid m-form__actions--right">
|
||||
<div class="row">
|
||||
|
|
|
|||
|
|
@ -80,6 +80,20 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group m-form__group row">
|
||||
<label class="col-3 col-form-label">
|
||||
In Mobile App:
|
||||
</label>
|
||||
<div class="col-3">
|
||||
<span class="m-switch m-switch--icon">
|
||||
<label>
|
||||
<input type="checkbox" name="flag_mobile" id="flag_mobile" value="1"{{ obj.shouldDisplayMobile() ? ' checked' }}>
|
||||
<span></span>
|
||||
</label>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="m-portlet__foot m-portlet__foot--fit">
|
||||
<div class="m-form__actions m-form__actions--solid m-form__actions--right">
|
||||
|
|
|
|||
Loading…
Reference in a new issue