From 5e910be1e74fc735d67fe2f28ad13528182fc6fe Mon Sep 17 00:00:00 2001 From: Ramon Gutierrez Date: Tue, 30 Jan 2018 12:52:39 +0800 Subject: [PATCH] Set customer vehicle name as optional, fix customer form to work with new gas and status values --- src/Entity/CustomerVehicle.php | 3 +-- templates/customer/form.html.twig | 28 +++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/Entity/CustomerVehicle.php b/src/Entity/CustomerVehicle.php index 75cd76d1..dc195b8a 100644 --- a/src/Entity/CustomerVehicle.php +++ b/src/Entity/CustomerVehicle.php @@ -23,8 +23,7 @@ class CustomerVehicle // user-defined name for vehicle /** - * @ORM\Column(type="string", length=80) - * @Assert\NotBlank() + * @ORM\Column(type="string", length=80, nullable=true) */ protected $name; diff --git a/templates/customer/form.html.twig b/templates/customer/form.html.twig index 8e916d07..15616462 100644 --- a/templates/customer/form.html.twig +++ b/templates/customer/form.html.twig @@ -151,7 +151,7 @@
- + Display name for this vehicle
@@ -957,14 +957,36 @@ field: 'status_condition', title: 'Cond.', template: function (row, index, datatable) { - return row.status_condition + ''; + var label; + + switch (row.status_condition) { + case 'new': + return 'Brand New'; + break; + case 'second-hand': + return 'Second-Hand'; + break; + } + + return label + ''; } }, { field: 'fuel_type', title: 'Fuel Type', template: function (row, index, datatable) { - return row.fuel_type + ''; + var label; + + switch (row.fuel_type) { + case 'gas': + return 'Gas'; + break; + case 'diesel': + return 'Diesel'; + break; + } + + return label + ''; } }, {