Merge branch '465-resq-august-13-release' of gitlab.com:jankstudio/resq into 464-resq-sms-message-to-customer-upon-jo-completion
This commit is contained in:
commit
cf684c21a0
5 changed files with 104 additions and 7 deletions
|
|
@ -511,6 +511,7 @@ class VehicleController extends Controller
|
|||
}
|
||||
|
||||
// add all other batteries, because they want options
|
||||
/*
|
||||
foreach ($all_batts as $battery)
|
||||
{
|
||||
// if we already listed it
|
||||
|
|
@ -528,6 +529,7 @@ class VehicleController extends Controller
|
|||
'warr_commercial' => $battery->getWarrantyCommercial(),
|
||||
];
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// NOTE: no need to order by price for control center / only for app
|
||||
|
|
|
|||
|
|
@ -346,6 +346,12 @@ class JobOrder
|
|||
*/
|
||||
protected $reasons_not_waiting;
|
||||
|
||||
// reason for not trading in battery
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80, nullable=true)
|
||||
*/
|
||||
protected $no_trade_in_reason;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_create = new DateTime();
|
||||
|
|
@ -997,4 +1003,15 @@ class JobOrder
|
|||
{
|
||||
return $this->reasons_not_waiting;
|
||||
}
|
||||
|
||||
public function setNoTradeInReason($reason)
|
||||
{
|
||||
$this->no_trade_in_reason = $reason;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNoTradeInReason()
|
||||
{
|
||||
return $this->no_trade_in_reason;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
20
src/Ramcar/NoTradeInReason.php
Normal file
20
src/Ramcar/NoTradeInReason.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace App\Ramcar;
|
||||
|
||||
class NoTradeInReason extends NameValue
|
||||
{
|
||||
const NO_EXISTING_BATTERY = 'no_existing_battery';
|
||||
const SELL_OTHER_SHOP = 'sell_other_shop';
|
||||
const SPARE_BATTERY = 'used_as_spare_battery';
|
||||
const RETURN_BATTERY_COMPANY = 'return_battery_company';
|
||||
const LOW_TRADE_IN_VALUE = 'low_trade_in_value';
|
||||
|
||||
const COLLECTION = [
|
||||
'no_existing_battery' => 'No existing battery',
|
||||
'sell_other_shop' => 'Sell to other shop',
|
||||
'used_as_spare_battery' => 'Used as spare battery',
|
||||
'return_battery_company' => 'Need to return battery to company',
|
||||
'low_trade_in_value' => 'Trade in value is low',
|
||||
];
|
||||
}
|
||||
|
|
@ -38,6 +38,7 @@ use App\Ramcar\TransactionOrigin;
|
|||
use App\Ramcar\FacilitatedType;
|
||||
use App\Ramcar\JORejectionReason;
|
||||
use App\Ramcar\CustomerNotWaitReason;
|
||||
use App\Ramcar\NoTradeInReason;
|
||||
|
||||
use App\Service\InvoiceGeneratorInterface;
|
||||
use App\Service\JobOrderHandlerInterface;
|
||||
|
|
@ -332,6 +333,17 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
else
|
||||
$reason = $req->request->get('no_wait_reason');
|
||||
|
||||
// check if trade in
|
||||
$is_trade_in = $req->request->get('invoice_trade_in_type');
|
||||
$no_trade_in_reason = '';
|
||||
if (empty($is_trade_in))
|
||||
{
|
||||
$no_trade_in_reason = $req->request->get('no_trade_in_reason');
|
||||
|
||||
if (empty($no_trade_in_reason))
|
||||
$error_array['no_trade_in_reason'] = 'No trade in reason required.';
|
||||
}
|
||||
|
||||
// TODO: check status before saving since JO might already
|
||||
// have a status that needs to be retained
|
||||
|
||||
|
|
@ -363,7 +375,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setModeOfPayment($req->request->get('mode_of_payment'))
|
||||
->setLandmark($req->request->get('landmark'))
|
||||
->setWillingToWait($req->request->get('flag_will_wait', false))
|
||||
->setReasonsNotWait($reason);
|
||||
->setReasonsNotWait($reason)
|
||||
->setNoTradeInReason($no_trade_in_reason);
|
||||
|
||||
// check if user is null, meaning call to create came from API
|
||||
if ($user != null)
|
||||
|
|
@ -465,6 +478,17 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
else
|
||||
$reason = $req->request->get('no_wait_reason');
|
||||
|
||||
// check if trade in
|
||||
$is_trade_in = $req->request->get('invoice_trade_in_type');
|
||||
$no_trade_in_reason = '';
|
||||
if (empty($is_trade_in))
|
||||
{
|
||||
$no_trade_in_reason = $req->request->get('no_trade_in_reason');
|
||||
|
||||
if (empty($no_trade_in_reason))
|
||||
$error_array['no_trade_in_reason'] = 'No trade in reason required.';
|
||||
}
|
||||
|
||||
if (empty($error_array))
|
||||
{
|
||||
// get current user
|
||||
|
|
@ -491,7 +515,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setModeOfPayment($req->request->get('mode_of_payment'))
|
||||
->setLandmark($req->request->get('landmark'))
|
||||
->setWillingToWait($req->request->get('flag_will_wait', false))
|
||||
->setReasonsNotWait($reason);
|
||||
->setReasonsNotWait($reason)
|
||||
->setNoTradeInReason($no_trade_in_reason);
|
||||
|
||||
// did they change invoice?
|
||||
$invoice_items = $req->request->get('invoice_items', []);
|
||||
|
|
@ -837,6 +862,17 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
else
|
||||
$reason = $req->request->get('no_wait_reason');
|
||||
|
||||
// check if trade in
|
||||
$is_trade_in = $req->request->get('invoice_trade_in_type');
|
||||
$no_trade_in_reason = '';
|
||||
if (empty($is_trade_in))
|
||||
{
|
||||
$no_trade_in_reason = $req->request->get('no_trade_in_reason');
|
||||
|
||||
if (empty($no_trade_in_reason))
|
||||
$error_array['no_trade_in_reason'] = 'No trade in reason required.';
|
||||
}
|
||||
|
||||
if (empty($error_array)) {
|
||||
// coordinates
|
||||
$point = new Point($req->request->get('coord_lng'), $req->request->get('coord_lat'));
|
||||
|
|
@ -854,7 +890,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setDeliveryAddress($req->request->get('delivery_address'))
|
||||
->setLandmark($req->request->get('landmark'))
|
||||
->setWillingToWait($req->request->get('flag_will_wait', false))
|
||||
->setReasonsNotWait($reason);
|
||||
->setReasonsNotWait($reason)
|
||||
->setNoTradeInReason($no_trade_in_reason);
|
||||
|
||||
// validate
|
||||
$errors = $this->validator->validate($obj);
|
||||
|
|
@ -2555,6 +2592,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$params['facilitated_hubs'] = $fac_hubs;
|
||||
$params['sources'] = TransactionOrigin::getCollection();
|
||||
$params['no_wait_reasons'] = CustomerNotWaitReason::getCollection();
|
||||
$params['no_trade_in_reasons'] = NoTradeInReason::getCollection();
|
||||
}
|
||||
|
||||
protected function initFormTags(&$params)
|
||||
|
|
|
|||
|
|
@ -308,6 +308,7 @@
|
|||
<div class="form-control-feedback hide" data-field="no_wait_reason"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-6">
|
||||
<label data-field="tier1_notes">Tier 1 Notes</label>
|
||||
|
|
@ -455,6 +456,14 @@
|
|||
<div class="form-control-feedback hide" data-field="promo_detail"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="col-lg-12 form-group-inner">
|
||||
<label>Email Address</label>
|
||||
<input type="text" name="customer_email" id="customer-email" class="form-control m-input" value="{{ obj.getCustomer ? obj.getCustomer.getEmail|default('') }}" data-vehicle-field="1" >
|
||||
<div class="form-control-feedback hide" data-field="customer_email"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-6">
|
||||
<label>Discount Type</label>
|
||||
|
|
@ -542,20 +551,31 @@
|
|||
<option value="">Select a vehicle and manufacturer first</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<div class="col-lg-1">
|
||||
<label for="invoice-trade-in-type">Trade In</label>
|
||||
<select class="form-control m-input" id="invoice-trade-in-type">
|
||||
<select class="form-control m-input" name="invoice_trade_in_type" id="invoice-trade-in-type">
|
||||
<option value="">None</option>
|
||||
{% for key, type in trade_in_types %}
|
||||
<option value="{{ key }}">{{ type }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<div class="col-lg-2">
|
||||
<label data-field="no_trade_in_reason">No Trade In Reason</label>
|
||||
<select class="form-control m-input" id="no-trade-in-reason" name="no_trade_in_reason">
|
||||
<option value="">Select reason</option>
|
||||
{% for key, class in no_trade_in_reasons %}
|
||||
<option value="{{ key }}"{{ obj.getNoTradeInReason == key ? ' selected' }}>{{ class }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div class="form-control-feedback hide" data-field="no_trade_in_reason"></div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1">
|
||||
<label for="invoice-quantity">Quantity</label>
|
||||
<input type="text" id="invoice-quantity" class="form-control m-input text-right" value="1">
|
||||
</div>
|
||||
<div class="col-lg-5">
|
||||
<div class="col-lg-3">
|
||||
<div><label> </label></div>
|
||||
<button type="button" class="btn btn-primary" id="btn-add-to-invoice">Add</button>
|
||||
<!--
|
||||
|
|
|
|||
Loading…
Reference in a new issue