Add Source of Awareness and Remarks to Ticket and ticket form. #661
This commit is contained in:
parent
4a93a2d482
commit
bbea317cf1
5 changed files with 135 additions and 2 deletions
|
|
@ -4,6 +4,8 @@ namespace App\Controller;
|
||||||
|
|
||||||
use App\Ramcar\TicketType;
|
use App\Ramcar\TicketType;
|
||||||
use App\Ramcar\TicketStatus;
|
use App\Ramcar\TicketStatus;
|
||||||
|
use App\Ramcar\SourceOfAwareness;
|
||||||
|
|
||||||
use App\Entity\Ticket;
|
use App\Entity\Ticket;
|
||||||
use App\Entity\Customer;
|
use App\Entity\Customer;
|
||||||
use App\Entity\JobOrder;
|
use App\Entity\JobOrder;
|
||||||
|
|
@ -172,6 +174,7 @@ class TicketController extends Controller
|
||||||
$params['statuses'] = TicketStatus::getCollection();
|
$params['statuses'] = TicketStatus::getCollection();
|
||||||
$params['other_ticket_type'] = TicketType::OTHER;
|
$params['other_ticket_type'] = TicketType::OTHER;
|
||||||
$params['redirect_url'] = $this->generateUrl('ticket_list');
|
$params['redirect_url'] = $this->generateUrl('ticket_list');
|
||||||
|
$params['soa_types'] = SourceOfAwareness::getCollection();
|
||||||
|
|
||||||
// set redirect url
|
// set redirect url
|
||||||
if ($customer)
|
if ($customer)
|
||||||
|
|
@ -240,6 +243,12 @@ class TicketController extends Controller
|
||||||
$other_ticket_type = $req->request->get('other_ticket_type');
|
$other_ticket_type = $req->request->get('other_ticket_type');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get source of awareness if any
|
||||||
|
$soa_type = $req->request->get('source_of_awareness');
|
||||||
|
|
||||||
|
// get remarks
|
||||||
|
$remarks = $req->request->get('remarks', '');
|
||||||
|
|
||||||
// set and save values
|
// set and save values
|
||||||
$obj->setFirstName($first_name)
|
$obj->setFirstName($first_name)
|
||||||
->setLastName($last_name)
|
->setLastName($last_name)
|
||||||
|
|
@ -250,7 +259,9 @@ class TicketController extends Controller
|
||||||
->setDetails($req->request->get('details'))
|
->setDetails($req->request->get('details'))
|
||||||
->setPlateNumber($req->request->get('plate_number'))
|
->setPlateNumber($req->request->get('plate_number'))
|
||||||
->setDateCreate(new DateTime())
|
->setDateCreate(new DateTime())
|
||||||
->setCreatedBy($this->getUser());
|
->setCreatedBy($this->getUser())
|
||||||
|
->setSourceOfAwareness($soa_type)
|
||||||
|
->setRemarks($remarks);
|
||||||
|
|
||||||
// if assigned to customer, set association
|
// if assigned to customer, set association
|
||||||
if ($customer_id) {
|
if ($customer_id) {
|
||||||
|
|
@ -326,6 +337,7 @@ class TicketController extends Controller
|
||||||
$params['statuses'] = TicketStatus::getCollection();
|
$params['statuses'] = TicketStatus::getCollection();
|
||||||
$params['other_ticket_type'] = TicketType::OTHER;
|
$params['other_ticket_type'] = TicketType::OTHER;
|
||||||
$params['redirect_url'] = $this->generateUrl('ticket_list');
|
$params['redirect_url'] = $this->generateUrl('ticket_list');
|
||||||
|
$params['soa_types'] = SourceOfAwareness::getCollection();
|
||||||
|
|
||||||
// set redirect url
|
// set redirect url
|
||||||
if ($customer)
|
if ($customer)
|
||||||
|
|
@ -423,6 +435,12 @@ class TicketController extends Controller
|
||||||
$other_ticket_type = $req->request->get('other_ticket_type');
|
$other_ticket_type = $req->request->get('other_ticket_type');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get source of awareness if any
|
||||||
|
$soa_type = $req->request->get('source_of_awareness');
|
||||||
|
|
||||||
|
// get remarks
|
||||||
|
$remarks = $req->request->get('remarks', '');
|
||||||
|
|
||||||
// set and save values
|
// set and save values
|
||||||
$obj->setFirstName($first_name)
|
$obj->setFirstName($first_name)
|
||||||
->setLastName($last_name)
|
->setLastName($last_name)
|
||||||
|
|
@ -431,7 +449,9 @@ class TicketController extends Controller
|
||||||
->setTicketType($ticket_type)
|
->setTicketType($ticket_type)
|
||||||
->setOtherTicketType($other_ticket_type)
|
->setOtherTicketType($other_ticket_type)
|
||||||
->setDetails($req->request->get('details'))
|
->setDetails($req->request->get('details'))
|
||||||
->setPlateNumber($req->request->get('plate_number'));
|
->setPlateNumber($req->request->get('plate_number'))
|
||||||
|
->setSourceOfAwareness($soa_type)
|
||||||
|
->setRemarks($remarks);
|
||||||
|
|
||||||
// initialize error list
|
// initialize error list
|
||||||
$error_array = [];
|
$error_array = [];
|
||||||
|
|
|
||||||
|
|
@ -372,6 +372,18 @@ class JobOrder
|
||||||
*/
|
*/
|
||||||
protected $rating;
|
protected $rating;
|
||||||
|
|
||||||
|
// source of awareness
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", length=80, nullable=true)
|
||||||
|
*/
|
||||||
|
protected $source_of_awareness;
|
||||||
|
|
||||||
|
// remarks related to source of awareness
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="text", nullable=true)
|
||||||
|
*/
|
||||||
|
protected $remarks;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->date_create = new DateTime();
|
$this->date_create = new DateTime();
|
||||||
|
|
@ -1061,4 +1073,26 @@ class JobOrder
|
||||||
{
|
{
|
||||||
return $this->rating;
|
return $this->rating;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setSourceOfAwareness($source_of_awareness)
|
||||||
|
{
|
||||||
|
$this->source_of_awareness = $source_of_awareness;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSourceOfAwareness()
|
||||||
|
{
|
||||||
|
return $this->source_of_awareness;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRemarks($remarks)
|
||||||
|
{
|
||||||
|
$this->remarks = $remarks;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRemarks()
|
||||||
|
{
|
||||||
|
return $this->remarks;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,18 @@ class Ticket
|
||||||
*/
|
*/
|
||||||
protected $job_order;
|
protected $job_order;
|
||||||
|
|
||||||
|
// source of awareness
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", length=80, nullable=true)
|
||||||
|
*/
|
||||||
|
protected $source_of_awareness;
|
||||||
|
|
||||||
|
// remarks related to source of awareness
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="text", nullable=true)
|
||||||
|
*/
|
||||||
|
protected $remarks;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->date_create = new DateTime();
|
$this->date_create = new DateTime();
|
||||||
|
|
@ -265,4 +277,27 @@ class Ticket
|
||||||
{
|
{
|
||||||
return $this->job_order;
|
return $this->job_order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setSourceOfAwareness($source_of_awareness)
|
||||||
|
{
|
||||||
|
$this->source_of_awareness = $source_of_awareness;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSourceOfAwareness()
|
||||||
|
{
|
||||||
|
return $this->source_of_awareness;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRemarks($remarks)
|
||||||
|
{
|
||||||
|
$this->remarks = $remarks;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRemarks()
|
||||||
|
{
|
||||||
|
return $this->remarks;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
25
src/Ramcar/SourceOfAwareness.php
Normal file
25
src/Ramcar/SourceOfAwareness.php
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Ramcar;
|
||||||
|
|
||||||
|
class SourceOfAwareness extends NameValue
|
||||||
|
{
|
||||||
|
const FACEBOOK = 'facebook';
|
||||||
|
const INSTAGRAM = 'instagram';
|
||||||
|
const RADIO_ADS = 'radio_ads';
|
||||||
|
const TARP_ADS = 'tarp_ads';
|
||||||
|
const FLYERS = 'flyers';
|
||||||
|
const WORD_OF_MOUTH = 'word_of_mouth';
|
||||||
|
const OTHER = 'other';
|
||||||
|
|
||||||
|
const COLLECTION = [
|
||||||
|
'facebook' => 'Facebook',
|
||||||
|
'instagram' => 'Instagram',
|
||||||
|
'radio_ads' => 'Radio Ads',
|
||||||
|
'tarp_ads' => 'Tarp Ads',
|
||||||
|
'flyers' => 'Flyers',
|
||||||
|
'word_of_mouth' => 'Word of Mouth',
|
||||||
|
'other' => 'Other',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -84,6 +84,25 @@
|
||||||
<div class="form-control-feedback hide" data-field="plate_number"></div>
|
<div class="form-control-feedback hide" data-field="plate_number"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group m-form__group row no-border">
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<label data-field="status">Source of Awareness</label>
|
||||||
|
<select class="form-control m-input" id="source-of-awareness" name="source_of_awareness">
|
||||||
|
<option value=""></option>
|
||||||
|
{% for key, soa in soa_types %}
|
||||||
|
<option value="{{ key }}"{{ key == obj.getSourceOfAwareness ? ' selected' }}>{{ soa }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
<div class="form-control-feedback hide" data-field="source_of_awareness"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group m-form__group row no-border">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<label for="remarks" data-field="remarks"> Remarks </label>
|
||||||
|
<textarea class="form-control m-input" id="remarks" rows="6" name="remarks">{{ obj.getRemarks }}</textarea>
|
||||||
|
<div class="form-control-feedback hide" data-field="remarks"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group m-form__group row no-border">
|
<div class="form-group m-form__group row no-border">
|
||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
<label data-field="status">Status</label>
|
<label data-field="status">Status</label>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue