Merge branch '181-tag-job-orders-as-facilitated-thru-hub-non-hub-or-annex' into 'master'
Resolve "Tag job orders as facilitated thru hub, non-hub, or annex" Closes #181 See merge request jankstudio/resq!215
This commit is contained in:
commit
1b6f26d07f
5 changed files with 118 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ use App\Ramcar\InvoiceStatus;
|
|||
use App\Ramcar\ModeOfPayment;
|
||||
use App\Ramcar\TransactionOrigin;
|
||||
use App\Ramcar\JOEventType;
|
||||
use App\Ramcar\FacilitatedType;
|
||||
|
||||
use App\Entity\JobOrder;
|
||||
use App\Entity\BatteryManufacturer;
|
||||
|
|
@ -137,6 +138,14 @@ class JobOrderController extends BaseController
|
|||
// $params['customers'] = $em->getRepository(Customer::class)->findAll();
|
||||
$params['promos'] = $em->getRepository(Promo::class)->findAll();
|
||||
|
||||
// list of hubs
|
||||
$hubs = $em->getRepository(Hub::class)->findBy([], ['name' => 'ASC']);
|
||||
$fac_hubs = [];
|
||||
foreach ($hubs as $hub)
|
||||
{
|
||||
$fac_hubs[$hub->getID()] = $hub->getName() . ' - ' . $hub->getBranch();
|
||||
}
|
||||
|
||||
// name values
|
||||
$params['service_types'] = ServiceType::getCollection();
|
||||
$params['warranty_classes'] = WarrantyClass::getCollection();
|
||||
|
|
@ -144,6 +153,8 @@ class JobOrderController extends BaseController
|
|||
$params['statuses'] = JOStatus::getCollection();
|
||||
$params['discount_apply'] = DiscountApply::getCollection();
|
||||
$params['trade_in_types'] = TradeInType::getCollection();
|
||||
$params['facilitated_types'] = FacilitatedType::getCollection();
|
||||
$params['facilitated_hubs'] = $fac_hubs;
|
||||
$params['sources'] = TransactionOrigin::getCollection();
|
||||
}
|
||||
|
||||
|
|
@ -986,6 +997,27 @@ class JobOrderController extends BaseController
|
|||
}
|
||||
}
|
||||
|
||||
// check facilitated type
|
||||
$fac_type = $req->request->get('facilitated_type');
|
||||
if (!empty($fac_type))
|
||||
{
|
||||
if (!FacilitatedType::validate($fac_type))
|
||||
$fac_type = null;
|
||||
}
|
||||
else
|
||||
$fac_type = null;
|
||||
|
||||
// check facilitated by
|
||||
$fac_by_id = $req->request->get('facilitated_by');
|
||||
$fac_by = null;
|
||||
if (!empty($fac_by_id))
|
||||
{
|
||||
$fac_by = $em->getRepository(Hub::class)->find($fac_by_id);
|
||||
if (empty($fac_by))
|
||||
$fac_by = null;
|
||||
}
|
||||
|
||||
|
||||
if (empty($error_array))
|
||||
{
|
||||
// coordinates
|
||||
|
|
@ -1003,6 +1035,8 @@ class JobOrderController extends BaseController
|
|||
->setTier1Notes($req->request->get('tier1_notes'))
|
||||
->setTier2Notes($req->request->get('tier2_notes'))
|
||||
->setDeliveryAddress($req->request->get('delivery_address'))
|
||||
->setFacilitatedType($fac_type)
|
||||
->setFacilitatedBy($fac_by)
|
||||
->setHub($hub);
|
||||
|
||||
// validate
|
||||
|
|
|
|||
|
|
@ -249,6 +249,19 @@ class JobOrder
|
|||
*/
|
||||
protected $flag_coolant;
|
||||
|
||||
// facilitated by hub, non-hub, annex
|
||||
/**
|
||||
* @ORM\Column(type="string", length=8, nullable=true)
|
||||
*/
|
||||
protected $facilitated_type;
|
||||
|
||||
// the location that facilitated the job order
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Hub", inversedBy="job_orders")
|
||||
* @ORM\JoinColumn(name="facilitated_hub_id", referencedColumnName="id", nullable=true)
|
||||
*/
|
||||
protected $facilitated_by;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_create = new DateTime();
|
||||
|
|
@ -742,4 +755,25 @@ class JobOrder
|
|||
return false;
|
||||
}
|
||||
|
||||
public function setFacilitatedType($type = null)
|
||||
{
|
||||
$this->facilitated_type = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFacilitatedType()
|
||||
{
|
||||
return $this->facilitated_type;
|
||||
}
|
||||
|
||||
public function setFacilitatedBy(Hub $hub = null)
|
||||
{
|
||||
$this->facilitated_by = $hub;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFacilitatedBy()
|
||||
{
|
||||
return $this->facilitated_by;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
16
src/Ramcar/FacilitatedType.php
Normal file
16
src/Ramcar/FacilitatedType.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace App\Ramcar;
|
||||
|
||||
class FacilitatedType extends NameValue
|
||||
{
|
||||
const HUB = 'hub';
|
||||
const NON_HUB = 'non-hub';
|
||||
const ANNEX = 'annex';
|
||||
|
||||
const COLLECTION = [
|
||||
'hub' => 'Hub',
|
||||
'non-hub' => 'Non-Hub',
|
||||
'annex' => 'Annex',
|
||||
];
|
||||
}
|
||||
|
|
@ -517,6 +517,29 @@
|
|||
{% if mode in ['update-processing', 'update-reassign-hub'] %}
|
||||
<div class="m-form__seperator m-form__seperator--dashed"></div>
|
||||
<div class="m-form__section">
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-2">
|
||||
<label for="faciliateted-type">Facilitated By</label>
|
||||
<select name="facilitated_type" class="form-control m-input" id="facilitated-type">
|
||||
<option value="">None</option>
|
||||
{% for key, type in facilitated_types %}
|
||||
<option value="{{ key }}">{{ type }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-8">
|
||||
<label for="faciliateted-by"> </label>
|
||||
<select name="facilitated_by" class="form-control m-input" id="facilitated-by">
|
||||
<option value="">None</option>
|
||||
{% for key, name in facilitated_hubs %}
|
||||
<option value="{{ key }}">{{ name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="m-form__seperator m-form__seperator--dashed"></div>
|
||||
<div class="m-form__section">
|
||||
<div class="m-form__heading">
|
||||
<h3 class="m-form__heading-title">
|
||||
Nearest Hubs
|
||||
|
|
|
|||
|
|
@ -401,6 +401,17 @@
|
|||
{% if mode in ['update-processing', 'update-reassign-hub'] %}
|
||||
<div class="m-form__seperator m-form__seperator--dashed"></div>
|
||||
<div class="m-form__section">
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-2">
|
||||
<label for="faciliateted-type"></label>
|
||||
<select class="form-control m-input" id="facilitated-type">
|
||||
<option value="">None</option>
|
||||
{% for key, type in facilitated_types %}
|
||||
<option value="{{ key }}">{{ type }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="m-form__heading">
|
||||
<h3 class="m-form__heading-title">
|
||||
Nearest Hubs
|
||||
|
|
|
|||
Loading…
Reference in a new issue