Add customer classification field

This commit is contained in:
Ramon Gutierrez 2018-01-31 23:55:16 +08:00
parent 14d702c42b
commit fa5122235a
2 changed files with 67 additions and 0 deletions

View file

@ -34,6 +34,13 @@ class Customer
*/ */
protected $last_name; protected $last_name;
// customer classification
/**
* @ORM\Column(type="string", length=80)
* @Assert\NotBlank()
*/
protected $customer_classification;
/** /**
* @ORM\Column(type="text", length=80) * @ORM\Column(type="text", length=80)
*/ */
@ -75,12 +82,21 @@ class Customer
*/ */
protected $flag_confirmed; protected $flag_confirmed;
// if registered on mobile app
/**
* @ORM\Column(type="boolean")
*/
protected $flag_mobile_app;
public function __construct() public function __construct()
{ {
$this->numbers = new ArrayCollection(); $this->numbers = new ArrayCollection();
$this->sessions = new ArrayCollection(); $this->sessions = new ArrayCollection();
$this->vehicles = new ArrayCollection(); $this->vehicles = new ArrayCollection();
$this->job_orders = new ArrayCollection(); $this->job_orders = new ArrayCollection();
$this->flag_confirmed = false;
$this->flag_mobile_app = false;
} }
public function getID() public function getID()
@ -110,6 +126,17 @@ class Customer
return $this->last_name; return $this->last_name;
} }
public function setCustomerClassification($customer_classification)
{
$this->customer_classification = $customer_classification;
return $this;
}
public function getCustomerClassification()
{
return $this->customer_classification;
}
public function setCustomerNotes($customer_notes) public function setCustomerNotes($customer_notes)
{ {
$this->customer_notes = $customer_notes; $this->customer_notes = $customer_notes;
@ -147,6 +174,15 @@ class Customer
return $numbers; return $numbers;
} }
public function getPlateNumberList()
{
$plate_numbers = [];
foreach ($this->vehicles as $vehicle)
$plate_numbers[] = $vehicle->getPlateNumber();
return $plate_numbers;
}
public function addMobileSession(MobileSession $session) public function addMobileSession(MobileSession $session)
{ {
$this->sessions->add($session); $this->sessions->add($session);
@ -192,6 +228,17 @@ class Customer
return $this->flag_confirmed; return $this->flag_confirmed;
} }
public function setHasMobileApp($flag_mobile_app = true)
{
$this->flag_mobile_app = $flag_mobile_app;
return $this;
}
public function hasMobileApp()
{
return $this->flag_mobile_app;
}
public function getJobOrders() public function getJobOrders()
{ {
return $this->job_orders; return $this->job_orders;

View file

@ -0,0 +1,20 @@
<?php
namespace App\Ramcar;
class CustomerClassification extends NameValue
{
const REGULAR = 'regular';
const MEDIA = 'media';
const VIP = 'vip';
const BLACKLISTED = 'blacklisted';
const OTHER = 'other';
const COLLECTION = [
'regular' => 'Regular',
'media' => 'Media',
'vip' => 'VIP',
'blacklisted' => 'Blacklisted',
'other' => 'Other',
];
}