Resolve "Customer form changes" #834
4 changed files with 88 additions and 8 deletions
|
|
@ -109,11 +109,13 @@ class CustomerController extends BaseController
|
|||
foreach ($obj_rows as $orow) {
|
||||
// add row data
|
||||
$row['id'] = $orow->getID();
|
||||
$row['title'] = $orow->getTitle();
|
||||
$row['first_name'] = $orow->getFirstName();
|
||||
$row['last_name'] = $orow->getLastName();
|
||||
$row['customer_classification'] = CustomerClassification::getName($orow->getCustomerClassification());
|
||||
$row['flag_mobile_app'] = $orow->hasMobileApp();
|
||||
$row['app_mobile_number'] = $orow->hasMobileApp() && !empty($orow->getMobileSessions()) ? $orow->getMobileSessions()[0]->getPhoneNumber() : '';
|
||||
$row['flag_active'] = $orow->isActive();
|
||||
|
||||
// TODO: properly add mobile numbers and plate numbers as searchable/sortable fields, use doctrine events
|
||||
$row['mobile_numbers'] = implode("<br>", $orow->getMobileNumberList());
|
||||
|
|
@ -173,10 +175,12 @@ class CustomerController extends BaseController
|
|||
$row = new Customer();
|
||||
|
||||
// set and save values
|
||||
$row->setFirstName($req->request->get('first_name'))
|
||||
$row->setTitle($req->request->get('title'))
|
||||
->setFirstName($req->request->get('first_name'))
|
||||
->setLastName($req->request->get('last_name'))
|
||||
->setCustomerClassification($req->request->get('customer_classification'))
|
||||
->setCustomerNotes($req->request->get('customer_notes'));
|
||||
->setCustomerNotes($req->request->get('customer_notes'))
|
||||
->setActive($req->request->get('flag_active') ? true : false);
|
||||
|
||||
// initialize error lists
|
||||
$error_array = [];
|
||||
|
|
@ -471,10 +475,12 @@ class CustomerController extends BaseController
|
|||
throw $this->createNotFoundException('The item does not exist');
|
||||
|
||||
// set and save values
|
||||
$cust->setFirstName($req->request->get('first_name'))
|
||||
$cust->setTitle($req->request->get('title'))
|
||||
->setFirstName($req->request->get('first_name'))
|
||||
->setLastName($req->request->get('last_name'))
|
||||
->setCustomerClassification($req->request->get('customer_classification'))
|
||||
->setCustomerNotes($req->request->get('customer_notes'));
|
||||
->setCustomerNotes($req->request->get('customer_notes'))
|
||||
->setActive($req->request->get('flag_active') ? true : false);
|
||||
|
||||
// initialize error lists
|
||||
$error_array = [];
|
||||
|
|
|
|||
|
|
@ -22,6 +22,13 @@ class Customer
|
|||
*/
|
||||
protected $id;
|
||||
|
||||
// title
|
||||
/**
|
||||
* @ORM\Column(type="string", length=10)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
// first name
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80)
|
||||
|
|
@ -90,6 +97,12 @@ class Customer
|
|||
*/
|
||||
protected $flag_mobile_app;
|
||||
|
||||
// if active
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $flag_active;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->numbers = new ArrayCollection();
|
||||
|
|
@ -102,6 +115,7 @@ class Customer
|
|||
|
||||
$this->flag_confirmed = false;
|
||||
$this->flag_mobile_app = false;
|
||||
$this->flag_active = false;
|
||||
}
|
||||
|
||||
public function getID()
|
||||
|
|
@ -109,6 +123,17 @@ class Customer
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function setFirstName($first_name)
|
||||
{
|
||||
$this->first_name = $first_name;
|
||||
|
|
@ -256,6 +281,17 @@ class Customer
|
|||
return $this->flag_mobile_app;
|
||||
}
|
||||
|
||||
public function setActive($flag_active = true)
|
||||
{
|
||||
$this->flag_active = $flag_active;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isActive()
|
||||
{
|
||||
return $this->flag_active;
|
||||
}
|
||||
|
||||
public function getJobOrders()
|
||||
{
|
||||
return $this->job_orders;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
</h3>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-6">
|
||||
<div class="col-lg-4">
|
||||
<label data-field="customer_classification">
|
||||
Customer Classification
|
||||
</label>
|
||||
|
|
@ -54,14 +54,21 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-6">
|
||||
<div class="col-lg-4">
|
||||
<label data-field="title">
|
||||
Title
|
||||
</label>
|
||||
<input type="text" name="title" class="form-control m-input" value="{{ obj.getTitle() }}" data-name="title">
|
||||
<div class="form-control-feedback hide" data-field="title"></div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<label data-field="first_name">
|
||||
First Name
|
||||
</label>
|
||||
<input type="text" name="first_name" class="form-control m-input" value="{{ obj.getFirstName() }}" data-name="first_name">
|
||||
<div class="form-control-feedback hide" data-field="first_name"></div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="col-lg-4">
|
||||
<label data-field="last_name">
|
||||
Last Name
|
||||
</label>
|
||||
|
|
@ -70,7 +77,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-6">
|
||||
<div class="col-lg-12">
|
||||
<label data-field="customer_notes">
|
||||
Customer Notes
|
||||
</label>
|
||||
|
|
@ -78,6 +85,18 @@
|
|||
<div class="form-control-feedback hide" data-field="customer_notes"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-12">
|
||||
<span class="m-switch m-switch--icon block-switch">
|
||||
<label>
|
||||
<input type="checkbox" name="flag_active" id="flag_active" value="1"{{ obj.isActive() ? ' checked' }}>
|
||||
<label class="switch-label">Active</label>
|
||||
<span></span>
|
||||
</label>
|
||||
</span>
|
||||
<div class="form-control-feedback hide" data-field="flag_active"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m-form__seperator m-form__seperator--dashed"></div>
|
||||
|
|
|
|||
|
|
@ -83,6 +83,10 @@
|
|||
title: 'ID',
|
||||
width: 30
|
||||
},
|
||||
{
|
||||
field: 'title',
|
||||
title: 'Title'
|
||||
},
|
||||
{
|
||||
field: 'first_name',
|
||||
title: 'First Name'
|
||||
|
|
@ -105,6 +109,21 @@
|
|||
title: 'Plate Numbers',
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
field: 'flag_active',
|
||||
title: 'Active',
|
||||
template: function (row, index, datatable) {
|
||||
var tag = '';
|
||||
|
||||
if (row.flag_active === true) {
|
||||
tag = '<span class="m-badge m-badge--success m-badge--wide">Yes</span>';
|
||||
} else {
|
||||
tag = '<span class="m-badge m-badge--danger m-badge--wide">No</span>';
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
},
|
||||
{#
|
||||
{
|
||||
field: 'flag_confirmed',
|
||||
|
|
|
|||
Loading…
Reference in a new issue