Change the wiling to wait checkbox into a dropdown. Add text field for not willing to wait. #479
This commit is contained in:
parent
1b88baa3de
commit
c30874e1c0
4 changed files with 148 additions and 62 deletions
|
|
@ -12,6 +12,7 @@ use DateTime;
|
|||
use App\Ramcar\ModeOfPayment;
|
||||
use App\Ramcar\JOStatus;
|
||||
use App\Ramcar\ServiceType;
|
||||
use App\Ramcar\WillingToWaitContent;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
|
|
@ -334,17 +335,23 @@ class JobOrder
|
|||
*/
|
||||
protected $phone_mobile;
|
||||
|
||||
// flag if customer is willing to wait
|
||||
// customer is willing to wait or not
|
||||
/**
|
||||
* @ORM\Column(type="boolean", nullable=true)
|
||||
* @ORM\Column(type="string", length=30)
|
||||
*/
|
||||
protected $flag_will_wait;
|
||||
protected $will_wait;
|
||||
|
||||
// reason for not willing to wait
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80, nullable=true)
|
||||
*/
|
||||
protected $reasons_not_waiting;
|
||||
protected $reason_not_waiting;
|
||||
|
||||
// more notes on why not willing to wait
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
protected $not_waiting_notes;
|
||||
|
||||
// reason for not trading in battery
|
||||
/**
|
||||
|
|
@ -375,7 +382,7 @@ class JobOrder
|
|||
|
||||
$this->phone_mobile = '';
|
||||
|
||||
$this->flag_will_wait = true;
|
||||
$this->will_wait = WillingToWaitContent::WILLING_TO_WAIT;
|
||||
}
|
||||
|
||||
public function getID()
|
||||
|
|
@ -982,26 +989,37 @@ class JobOrder
|
|||
return $this->phone_mobile;
|
||||
}
|
||||
|
||||
public function setWillingToWait($flag = true)
|
||||
public function setWillWait($will_wait)
|
||||
{
|
||||
$this->flag_will_wait = $flag;
|
||||
$this->will_wait = $will_wait;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isWillingToWait()
|
||||
public function getWillWait()
|
||||
{
|
||||
return $this->flag_will_wait;
|
||||
return $this->will_wait;
|
||||
}
|
||||
|
||||
public function setReasonsNotWait($reasons)
|
||||
public function setReasonNotWait($reason)
|
||||
{
|
||||
$this->reasons_not_waiting = $reasons;
|
||||
$this->reason_not_waiting = $reason;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReasonsNotWait()
|
||||
public function getReasonNotWait()
|
||||
{
|
||||
return $this->reasons_not_waiting;
|
||||
return $this->reason_not_waiting;
|
||||
}
|
||||
|
||||
public function setNotWaitingNotes($notes)
|
||||
{
|
||||
$this->not_waiting_notes = $notes;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNotWaitingNotes()
|
||||
{
|
||||
return $this->not_waiting_notes;
|
||||
}
|
||||
|
||||
public function setNoTradeInReason($reason)
|
||||
|
|
|
|||
|
|
@ -7,10 +7,16 @@ class CustomerNotWaitReason extends NameValue
|
|||
const EMERGENCY = 'emergency';
|
||||
const USE_VEHICLE_NOW = 'use_vehicle_now';
|
||||
const WITH_APPOINTMENT = 'with_appointment';
|
||||
const POST_REPLACEMENT = 'post_replacement';
|
||||
const POST_RECHARGE = 'post_recharge';
|
||||
const NORMAL_REQUEST_NOT_URGENT = 'normal_request_not_urgent';
|
||||
|
||||
const COLLECTION = [
|
||||
'emergency' => 'Emergency',
|
||||
'use_vehicle_now' => 'Need to Use Vehicle Now',
|
||||
'with_appointment' => 'With Appointment',
|
||||
'post_replacement' => 'Post Replacement',
|
||||
'post_recharge' => 'Post Recharge',
|
||||
'normal_request_not_urgent' => 'Normal Request not Urgent (Rush below TAT)',
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ use App\Ramcar\FacilitatedType;
|
|||
use App\Ramcar\JORejectionReason;
|
||||
use App\Ramcar\CustomerNotWaitReason;
|
||||
use App\Ramcar\NoTradeInReason;
|
||||
use App\Ramcar\WillingToWaitContent;
|
||||
|
||||
use App\Service\InvoiceGeneratorInterface;
|
||||
use App\Service\JobOrderHandlerInterface;
|
||||
|
|
@ -330,11 +331,15 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$error_array['landmark'] = 'Landmark is required.';
|
||||
|
||||
// check if customer is not willing to wait
|
||||
$will_wait = $req->request->get('flag_will_wait');
|
||||
if ($will_wait)
|
||||
$reason = '';
|
||||
else
|
||||
$will_wait = $req->request->get('flag_willing_to_wait');
|
||||
$reason = '';
|
||||
$more_reason = '';
|
||||
if ($will_wait == WillingToWaitContent::NOT_WILLING_TO_WAIT)
|
||||
{
|
||||
// get the reason and text
|
||||
$reason = $req->request->get('no_wait_reason');
|
||||
$more_reason = $req->request->get('not_wait_notes');
|
||||
}
|
||||
|
||||
// check if trade in
|
||||
$is_trade_in = $req->request->get('invoice_trade_in_type');
|
||||
|
|
@ -377,8 +382,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setPromoDetail($req->request->get('promo_detail'))
|
||||
->setModeOfPayment($req->request->get('mode_of_payment'))
|
||||
->setLandmark($req->request->get('landmark'))
|
||||
->setWillingToWait($req->request->get('flag_will_wait', false))
|
||||
->setReasonsNotWait($reason)
|
||||
->setWillWait($req->request->get('flag_willing_to_wait'))
|
||||
->setReasonNotWait($reason)
|
||||
->setNotWaitingNotes($more_reason)
|
||||
->setNoTradeInReason($no_trade_in_reason);
|
||||
|
||||
// check if user is null, meaning call to create came from API
|
||||
|
|
@ -475,11 +481,15 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$error_array['landmark'] = 'Landmark is required.';
|
||||
|
||||
// check if customer is not willing to wait
|
||||
$will_wait = $req->request->get('flag_will_wait');
|
||||
if ($will_wait)
|
||||
$reason = '';
|
||||
else
|
||||
$will_wait = $req->request->get('flag_willing_to_wait');
|
||||
$reason = '';
|
||||
$more_reason = '';
|
||||
if ($will_wait == WillingToWaitContent::NOT_WILLING_TO_WAIT)
|
||||
{
|
||||
// get the reason and text
|
||||
$reason = $req->request->get('no_wait_reason');
|
||||
$more_reason = $req->request->get('not_wait_notes');
|
||||
}
|
||||
|
||||
// check if trade in
|
||||
$is_trade_in = $req->request->get('invoice_trade_in_type');
|
||||
|
|
@ -517,8 +527,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setPromoDetail($req->request->get('promo_detail'))
|
||||
->setModeOfPayment($req->request->get('mode_of_payment'))
|
||||
->setLandmark($req->request->get('landmark'))
|
||||
->setWillingToWait($req->request->get('flag_will_wait', false))
|
||||
->setReasonsNotWait($reason)
|
||||
->setWillWait($req->request->get('flag_willing_to_wait'))
|
||||
->setReasonNotWait($reason)
|
||||
->setNotWaitingNotes($more_reason)
|
||||
->setNoTradeInReason($no_trade_in_reason);
|
||||
|
||||
// did they change invoice?
|
||||
|
|
@ -655,11 +666,15 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$error_array['landmark'] = 'Landmark is required.';
|
||||
|
||||
// check if customer is not willing to wait
|
||||
$will_wait = $req->request->get('flag_will_wait');
|
||||
if ($will_wait)
|
||||
$reason = '';
|
||||
else
|
||||
$will_wait = $req->request->get('flag_willing_to_wait');
|
||||
$reason = '';
|
||||
$more_reason = '';
|
||||
if ($will_wait == WillingToWaitContent::NOT_WILLING_TO_WAIT)
|
||||
{
|
||||
// get the reason and text
|
||||
$reason = $req->request->get('no_wait_reason');
|
||||
$more_reason = $req->request->get('not_wait_notes');
|
||||
}
|
||||
|
||||
if (empty($error_array))
|
||||
{
|
||||
|
|
@ -682,8 +697,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setFacilitatedBy($fac_by)
|
||||
->setHub($hub)
|
||||
->setLandmark($req->request->get('landmark'))
|
||||
->setWillingToWait($req->request->get('flag_will_wait', false))
|
||||
->setReasonsNotWait($reason);
|
||||
->setWillWait($req->request->get('flag_willing_to_wait'))
|
||||
->setReasonNotWait($reason)
|
||||
->setNotWaitingNotes($more_reason);
|
||||
|
||||
// validate
|
||||
$errors = $this->validator->validate($obj);
|
||||
|
|
@ -762,11 +778,15 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$error_array['landmark'] = 'Landmark is required.';
|
||||
|
||||
// check if customer is not willing to wait
|
||||
$will_wait = $req->request->get('flag_will_wait');
|
||||
if ($will_wait)
|
||||
$reason = '';
|
||||
else
|
||||
$will_wait = $req->request->get('flag_willing_to_wait');
|
||||
$reason = '';
|
||||
$more_reason = '';
|
||||
if ($will_wait == WillingToWaitContent::NOT_WILLING_TO_WAIT)
|
||||
{
|
||||
// get the reason and text
|
||||
$reason = $req->request->get('no_wait_reason');
|
||||
$more_reason = $req->request->get('not_wait_notes');
|
||||
}
|
||||
|
||||
// get current user
|
||||
$user = $this->security->getUser();
|
||||
|
|
@ -790,8 +810,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setDateAssign(new DateTime())
|
||||
->setRider($rider)
|
||||
->setLandmark($req->request->get('landmark'))
|
||||
->setWillingToWait($req->request->get('flag_will_wait', false))
|
||||
->setReasonsNotWait($reason);
|
||||
->setWillWait($req->request->get('flag_willing_to_wait'))
|
||||
->setReasonNotWait($reason)
|
||||
->setNotWaitingNotes($more_reason);
|
||||
|
||||
if ($user != null)
|
||||
{
|
||||
|
|
@ -859,11 +880,15 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$error_array['landmark'] = 'Landmark is required.';
|
||||
|
||||
// check if customer is not willing to wait
|
||||
$will_wait = $req->request->get('flag_will_wait');
|
||||
if ($will_wait)
|
||||
$reason = '';
|
||||
else
|
||||
$will_wait = $req->request->get('flag_willing_to_wait');
|
||||
$reason = '';
|
||||
$more_reason = '';
|
||||
if ($will_wait == WillingToWaitContent::NOT_WILLING_TO_WAIT)
|
||||
{
|
||||
// get the reason and text
|
||||
$reason = $req->request->get('no_wait_reason');
|
||||
$more_reason = $req->request->get('not_wait_notes');
|
||||
}
|
||||
|
||||
if (empty($error_array)) {
|
||||
// coordinates
|
||||
|
|
@ -881,8 +906,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setTier2Notes($req->request->get('tier2_notes'))
|
||||
->setDeliveryAddress($req->request->get('delivery_address'))
|
||||
->setLandmark($req->request->get('landmark'))
|
||||
->setWillingToWait($req->request->get('flag_will_wait', false))
|
||||
->setReasonsNotWait($reason);
|
||||
->setWillWait($req->request->get('flag_willing_to_wait'))
|
||||
->setReasonNotWait($reason)
|
||||
->setNotWaitingNotes($more_reason);
|
||||
|
||||
// validate
|
||||
$errors = $this->validator->validate($obj);
|
||||
|
|
@ -1066,11 +1092,15 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
error_log($req->request->get('landmark'));
|
||||
|
||||
// check if customer is not willing to wait
|
||||
$will_wait = $req->request->get('flag_will_wait');
|
||||
if ($will_wait)
|
||||
$reason = '';
|
||||
else
|
||||
$will_wait = $req->request->get('flag_willing_to_wait');
|
||||
$reason = '';
|
||||
$more_reason = '';
|
||||
if ($will_wait == WillingToWaitContent::NOT_WILLING_TO_WAIT)
|
||||
{
|
||||
// get the reason and text
|
||||
$reason = $req->request->get('no_wait_reason');
|
||||
$more_reason = $req->request->get('not_wait_notes');
|
||||
}
|
||||
|
||||
if (empty($error_array))
|
||||
{
|
||||
|
|
@ -1100,8 +1130,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setDeliveryAddress($req->request->get('delivery_address'))
|
||||
->setHub($hub)
|
||||
->setLandmark($req->request->get('landmark'))
|
||||
->setWillingToWait($req->request->get('flag_will_wait', false))
|
||||
->setReasonsNotWait($reason)
|
||||
->setWillWait($req->request->get('flag_willing_to_wait'))
|
||||
->setReasonNotWait($reason)
|
||||
->setNotWaitingNotes($more_reason)
|
||||
->clearRider();
|
||||
|
||||
if ($user != null)
|
||||
|
|
@ -1281,11 +1312,15 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$error_array['landmark'] = 'Landmark is required.';
|
||||
|
||||
// check if customer is not willing to wait
|
||||
$will_wait = $req->request->get('flag_will_wait');
|
||||
if ($will_wait)
|
||||
$reason = '';
|
||||
else
|
||||
$will_wait = $req->request->get('flag_willing_to_wait');
|
||||
$reason = '';
|
||||
$more_reason = '';
|
||||
if ($will_wait == WillingToWaitContent::NOT_WILLING_TO_WAIT)
|
||||
{
|
||||
// get the reason and text
|
||||
$reason = $req->request->get('no_wait_reason');
|
||||
$more_reason = $req->request->get('not_wait_notes');
|
||||
}
|
||||
|
||||
if (empty($error_array)) {
|
||||
// rider mqtt event
|
||||
|
|
@ -1315,8 +1350,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setDateAssign(new DateTime())
|
||||
->setRider($rider)
|
||||
->setLandmark($req->request->get('landmark'))
|
||||
->setWillingToWait($req->request->get('flag_will_wait', false))
|
||||
->setReasonsNotWait($reason);
|
||||
->setWillWait($req->request->get('flag_willing_to_wait'))
|
||||
->setReasonNotWait($reason)
|
||||
->setNotWaitingNotes($more_reason);
|
||||
|
||||
if ($user != null)
|
||||
{
|
||||
|
|
@ -2588,6 +2624,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$params['facilitated_types'] = FacilitatedType::getCollection();
|
||||
$params['facilitated_hubs'] = $fac_hubs;
|
||||
$params['sources'] = TransactionOrigin::getCollection();
|
||||
$params['willing_to_wait_content'] = WillingToWaitContent::getCollection();
|
||||
$params['no_wait_reasons'] = CustomerNotWaitReason::getCollection();
|
||||
$params['no_trade_in_reasons'] = NoTradeInReason::getCollection();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -293,20 +293,29 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="form-group m-form__group row">
|
||||
<div class="col-lg-6">
|
||||
<input type="checkbox" name="flag_will_wait" id="flag-will-wait" value="1"{{ obj.isWillingToWait ? ' checked' }} >
|
||||
<label class="switch-label">Willing to Wait</label>
|
||||
<div class="form-control-feedback hide" data-field="flag_will_wait"></div>
|
||||
<div class="col-lg-4">
|
||||
<label data-field="flag_will_wait">Willing to Wait</label>
|
||||
<select class="form-control m-input" id="flag-willing-to-wait" name="flag_willing_to_wait">
|
||||
{% for key, class in willing_to_wait_content %}
|
||||
<option value="{{ key }}"{{ obj.getWillWait == key ? ' selected' }}>{{ class }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div class="form-control-feedback hide" data-field="flag_willing_to_wait"></div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="col-lg-4">
|
||||
<label data-field="no_wait_reason">Reason Why Not Willing to Wait</label>
|
||||
<select class="form-control m-input" id="no-wait-reason" name="no_wait_reason">
|
||||
<select class="form-control m-input" id="no-wait-reason" name="no_wait_reason" disabled>
|
||||
{% for key, class in no_wait_reasons %}
|
||||
<option value="{{ key }}"{{ obj.getReasonsNotWait == key ? ' selected' }}>{{ class }}</option>
|
||||
<option value="{{ key }}"{{ obj.getReasonNotWait == key ? ' selected' }}>{{ class }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div class="form-control-feedback hide" data-field="no_wait_reason"></div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<label data-field="not_wait_notes">Notes on Not Willing to Wait</label>
|
||||
<textarea name="not_wait_notes" id="not-wait-notes" class="form-control m-input" rows="2" disabled>{{ obj.getNotWaitingNotes }}</textarea>
|
||||
<div class="form-control-feedback hide" data-field="not_wait_notes"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group m-form__group row">
|
||||
|
|
@ -1851,6 +1860,22 @@ $(function() {
|
|||
});
|
||||
|
||||
});
|
||||
|
||||
$("#flag-willing-to-wait").change(function() {
|
||||
var field_value = $(this).val();
|
||||
var field = $("#flag-willing-to-wait");
|
||||
console.log(field_value);
|
||||
|
||||
if (field_value == 'not_willing_to_wait') {
|
||||
console.log('enable please');
|
||||
$("#no-wait-reason").attr("disabled", false);
|
||||
$("#not-wait-notes").attr("disabled", false);
|
||||
} else {
|
||||
console.log('disable please');
|
||||
$("#no-wait-reason").attr("disabled", true);
|
||||
$("#not-wait-notes").attr("disabled", true);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Reference in a new issue