Replace contact numbers with individual numbers in customer entity, controllers, and templates #UAT
This commit is contained in:
parent
99401b95e6
commit
5769e1c366
3 changed files with 152 additions and 0 deletions
|
|
@ -417,6 +417,7 @@ class CustomerController extends BaseController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public function updateNumbers($em, Customer $cust, $numbers)
|
public function updateNumbers($em, Customer $cust, $numbers)
|
||||||
{
|
{
|
||||||
$number_ids = [];
|
$number_ids = [];
|
||||||
|
|
@ -461,6 +462,7 @@ class CustomerController extends BaseController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public function updateSubmit(Request $req, ValidatorInterface $validator, $id)
|
public function updateSubmit(Request $req, ValidatorInterface $validator, $id)
|
||||||
{
|
{
|
||||||
|
|
@ -490,9 +492,16 @@ class CustomerController extends BaseController
|
||||||
// TODO: validate mobile numbers
|
// TODO: validate mobile numbers
|
||||||
// TODO: validate vehicles
|
// TODO: validate vehicles
|
||||||
|
|
||||||
|
/*
|
||||||
// custom validation for mobile numbers
|
// custom validation for mobile numbers
|
||||||
$numbers = json_decode($req->request->get('mobile_numbers'));
|
$numbers = json_decode($req->request->get('mobile_numbers'));
|
||||||
$this->updateNumbers($em, $cust, $numbers);
|
$this->updateNumbers($em, $cust, $numbers);
|
||||||
|
*/
|
||||||
|
// phone numbers
|
||||||
|
$cust->setPhoneMobile($req->request->get('phone_mobile'))
|
||||||
|
->setPhoneLandline($req->request->get('phone_landline'))
|
||||||
|
->setPhoneOffice($req->request->get('phone_office'))
|
||||||
|
->setPhoneFax($req->request->get('phone_fax'));
|
||||||
|
|
||||||
// custom validation for vehicles
|
// custom validation for vehicles
|
||||||
$vehicles = json_decode($req->request->get('vehicles'));
|
$vehicles = json_decode($req->request->get('vehicles'));
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,30 @@ class Customer
|
||||||
*/
|
*/
|
||||||
protected $numbers;
|
protected $numbers;
|
||||||
|
|
||||||
|
// mobile phone
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="text", length=12)
|
||||||
|
*/
|
||||||
|
protected $phone_mobile;
|
||||||
|
|
||||||
|
// landline
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="text", length=12)
|
||||||
|
*/
|
||||||
|
protected $phone_landline;
|
||||||
|
|
||||||
|
// office phone
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="text", length=12)
|
||||||
|
*/
|
||||||
|
protected $phone_office;
|
||||||
|
|
||||||
|
// fax
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="text", length=12)
|
||||||
|
*/
|
||||||
|
protected $phone_fax;
|
||||||
|
|
||||||
// mobile sessions linked to this customer
|
// mobile sessions linked to this customer
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity="MobileSession", mappedBy="customer")
|
* @ORM\OneToMany(targetEntity="MobileSession", mappedBy="customer")
|
||||||
|
|
@ -117,6 +141,11 @@ class Customer
|
||||||
$this->flag_confirmed = false;
|
$this->flag_confirmed = false;
|
||||||
$this->flag_mobile_app = false;
|
$this->flag_mobile_app = false;
|
||||||
$this->flag_active = true;
|
$this->flag_active = true;
|
||||||
|
|
||||||
|
$this->phone_mobile = '';
|
||||||
|
$this->phone_landline = '';
|
||||||
|
$this->phone_office = '';
|
||||||
|
$this->phone_fax = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getID()
|
public function getID()
|
||||||
|
|
@ -179,6 +208,7 @@ class Customer
|
||||||
return $this->customer_notes;
|
return $this->customer_notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public function addMobileNumber(MobileNumber $number)
|
public function addMobileNumber(MobileNumber $number)
|
||||||
{
|
{
|
||||||
$this->numbers->add($number);
|
$this->numbers->add($number);
|
||||||
|
|
@ -210,6 +240,70 @@ class Customer
|
||||||
|
|
||||||
return $numbers;
|
return $numbers;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getMobileNumberList()
|
||||||
|
{
|
||||||
|
$phones = [];
|
||||||
|
|
||||||
|
if (!empty($this->phone_mobile))
|
||||||
|
$phones[] = '+63' . $this->phone_mobile;
|
||||||
|
|
||||||
|
if (!empty($this->phone_landline))
|
||||||
|
$phones[] = '+63' . $this->phone_landline;
|
||||||
|
|
||||||
|
if (!empty($this->phone_office))
|
||||||
|
$phones[] = '+63' . $this->phone_office;
|
||||||
|
|
||||||
|
if (!empty($this->phone_fax))
|
||||||
|
$phones[] = '+63' . $this->phone_fax;
|
||||||
|
|
||||||
|
return $phones;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPhoneMobile($phone)
|
||||||
|
{
|
||||||
|
$this->phone_mobile = $phone;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPhoneMobile()
|
||||||
|
{
|
||||||
|
return $this->phone_mobile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPhoneLandline($phone)
|
||||||
|
{
|
||||||
|
$this->phone_landline = $phone;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPhoneLandline()
|
||||||
|
{
|
||||||
|
return $this->phone_landline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPhoneOffice($phone)
|
||||||
|
{
|
||||||
|
$this->phone_office = $phone;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPhoneOffice()
|
||||||
|
{
|
||||||
|
return $this->phone_office;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPhoneFax($phone)
|
||||||
|
{
|
||||||
|
$this->phone_fax = $phone;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPhoneFax()
|
||||||
|
{
|
||||||
|
return $this->phone_fax;
|
||||||
|
}
|
||||||
|
|
||||||
public function getPlateNumberList()
|
public function getPlateNumberList()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,52 @@
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group m-form__group row">
|
<div class="form-group m-form__group row">
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<label data-field="phone_mobile">
|
||||||
|
Mobile Phone
|
||||||
|
</label>
|
||||||
|
<div class="input-group m-input-group">
|
||||||
|
<span class="input-group-addon">+63</span>
|
||||||
|
<input type="text" name="phone_mobile" class="form-control m-input" value="{{ obj.getPhoneMobile|default('') }}" data-name="phone_mobile">
|
||||||
|
<div class="form-control-feedback hide" data-field="phone_mobile"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<label data-field="phone_landline">
|
||||||
|
Landline
|
||||||
|
</label>
|
||||||
|
<div class="input-group m-input-group">
|
||||||
|
<span class="input-group-addon">+63</span>
|
||||||
|
<input type="text" name="phone_landline" class="form-control m-input" value="{{ obj.getPhoneLandline|default('') }}" data-name="phone_landline">
|
||||||
|
<div class="form-control-feedback hide" data-field="phone_landline"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group m-form__group row">
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<label data-field="phone_office">
|
||||||
|
Office Phone
|
||||||
|
</label>
|
||||||
|
<div class="input-group m-input-group">
|
||||||
|
<span class="input-group-addon">+63</span>
|
||||||
|
<input type="text" name="phone_office" class="form-control m-input" value="{{ obj.getPhoneOffice|default('') }}" data-name="phone_office">
|
||||||
|
<div class="form-control-feedback hide" data-field="phone_office"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<label data-field="phone_fax">
|
||||||
|
Fax
|
||||||
|
</label>
|
||||||
|
<div class="input-group m-input-group">
|
||||||
|
<span class="input-group-addon">+63</span>
|
||||||
|
<input type="text" name="phone_fax" class="form-control m-input" value="{{ obj.getPhoneFax|default('') }}" data-name="phone_fax">
|
||||||
|
<div class="form-control-feedback hide" data-field="phone_fax"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#
|
||||||
|
<div class="form-group m-form__group row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div id="data-mobile-numbers"></div>
|
<div id="data-mobile-numbers"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -122,6 +168,7 @@
|
||||||
<button type="button" class="btn btn-primary" id="btn-add-mobile-number" maxlength="12">Add to List</button>
|
<button type="button" class="btn btn-primary" id="btn-add-mobile-number" maxlength="12">Add to List</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
#}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="m-form__seperator m-form__seperator--dashed"></div>
|
<div class="m-form__seperator m-form__seperator--dashed"></div>
|
||||||
|
|
@ -537,6 +584,7 @@
|
||||||
var vehicleRows = [];
|
var vehicleRows = [];
|
||||||
var ticketRows = [];
|
var ticketRows = [];
|
||||||
|
|
||||||
|
{#
|
||||||
{% for number in obj.getMobileNumbers() %}
|
{% for number in obj.getMobileNumbers() %}
|
||||||
nrow = {
|
nrow = {
|
||||||
id: "{{ number.getID() }}",
|
id: "{{ number.getID() }}",
|
||||||
|
|
@ -546,6 +594,7 @@
|
||||||
numberRows.push(nrow);
|
numberRows.push(nrow);
|
||||||
numberIds.push("{{ number.getID() }}");
|
numberIds.push("{{ number.getID() }}");
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
#}
|
||||||
|
|
||||||
{% for key, cv in obj.getVehicles() %}
|
{% for key, cv in obj.getVehicles() %}
|
||||||
{% set vehicle = cv.getVehicle() %}
|
{% set vehicle = cv.getVehicle() %}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue