Set year range to current + 1, change customer vehicle year selection to dropdown
This commit is contained in:
parent
e67e5f3f16
commit
834ecddbb7
3 changed files with 17 additions and 2 deletions
|
|
@ -142,6 +142,8 @@ class CustomerController extends BaseController
|
|||
$params['bmfgs'] = $em->getRepository(BatteryManufacturer::class)->findAll();
|
||||
$params['vmfgs'] = $em->getRepository(VehicleManufacturer::class)->findAll();
|
||||
|
||||
$params['years'] = $this->generateYearOptions();
|
||||
|
||||
// response
|
||||
return $this->render('customer/form.html.twig', $params);
|
||||
}
|
||||
|
|
@ -302,6 +304,8 @@ class CustomerController extends BaseController
|
|||
$params['bmfgs'] = $em->getRepository(BatteryManufacturer::class)->findAll();
|
||||
$params['vmfgs'] = $em->getRepository(VehicleManufacturer::class)->findAll();
|
||||
|
||||
$params['years'] = $this->generateYearOptions();
|
||||
|
||||
$params['obj'] = $row;
|
||||
|
||||
// response
|
||||
|
|
@ -527,6 +531,12 @@ class CustomerController extends BaseController
|
|||
$response->send();
|
||||
}
|
||||
|
||||
protected function generateYearOptions()
|
||||
{
|
||||
$start_year = 1950;
|
||||
return range($start_year, date("Y") + 1);
|
||||
}
|
||||
|
||||
// check if datatable filter is present and append to query
|
||||
protected function setQueryFilters($datatable, &$query) {
|
||||
if (isset($datatable['query']['data-rows-search']) && !empty($datatable['query']['data-rows-search'])) {
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ class VehicleController extends BaseController
|
|||
protected function generateYearOptions()
|
||||
{
|
||||
$start_year = 1950;
|
||||
return range($start_year, date("Y"));
|
||||
return range($start_year, date("Y") + 1);
|
||||
}
|
||||
|
||||
// check if datatable filter is present and append to query
|
||||
|
|
|
|||
|
|
@ -165,7 +165,12 @@
|
|||
</div>
|
||||
<div class="col-lg-3">
|
||||
<label for="vehicle-year" data-field="model_year">Year</label>
|
||||
<input type="text" name="model_year" id="vehicle-year" class="form-control m-input" data-required="1">
|
||||
<select class="form-control m-input" id="vehicle-year" name="model_year" data-required="1">
|
||||
<option value=""></option>
|
||||
{% for year in years %}
|
||||
<option value="{{ year }}">{{ year }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div class="form-control-feedback hide" data-field="model_year"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue