Add the customer tag to JO form. #558
This commit is contained in:
parent
bbc0647925
commit
c41c824744
3 changed files with 42 additions and 1 deletions
|
|
@ -548,6 +548,7 @@ class ResqCustomerHandler implements CustomerHandlerInterface
|
||||||
'flag_promo_email' => $customer->isPromoEmail(),
|
'flag_promo_email' => $customer->isPromoEmail(),
|
||||||
'flag_research_sms' => $customer->isResearchSms(),
|
'flag_research_sms' => $customer->isResearchSms(),
|
||||||
'flag_research_email' => $customer->isResearchEmail(),
|
'flag_research_email' => $customer->isResearchEmail(),
|
||||||
|
'customer_tags' => $customer->getCustomerTags(),
|
||||||
],
|
],
|
||||||
'vehicle' => [
|
'vehicle' => [
|
||||||
'id' => $vehicle->getID(),
|
'id' => $vehicle->getID(),
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ use App\Entity\Rider;
|
||||||
use App\Entity\JORejection;
|
use App\Entity\JORejection;
|
||||||
use App\Entity\Warranty;
|
use App\Entity\Warranty;
|
||||||
use App\Entity\Customer;
|
use App\Entity\Customer;
|
||||||
|
use App\Entity\CustomerTag;
|
||||||
|
|
||||||
use App\Ramcar\InvoiceCriteria;
|
use App\Ramcar\InvoiceCriteria;
|
||||||
use App\Ramcar\ServiceType;
|
use App\Ramcar\ServiceType;
|
||||||
|
|
@ -2731,6 +2732,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$fac_hubs[$hub->getID()] = $hub->getName() . ' - ' . $hub->getBranch();
|
$fac_hubs[$hub->getID()] = $hub->getName() . ' - ' . $hub->getBranch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// list of customer tags
|
||||||
|
$params['customer_tags'] = $em->getRepository(CustomerTag::class)->findAll();
|
||||||
|
|
||||||
// name values
|
// name values
|
||||||
$params['service_types'] = ServiceType::getCollection();
|
$params['service_types'] = ServiceType::getCollection();
|
||||||
$params['warranty_classes'] = WarrantyClass::getCollection();
|
$params['warranty_classes'] = WarrantyClass::getCollection();
|
||||||
|
|
|
||||||
|
|
@ -201,11 +201,29 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-3">
|
<div class="col-lg-3">
|
||||||
{% if is_granted('customer.dpa') %}
|
{% if is_granted('customer.dpa') %}
|
||||||
<input type="checkbox" name="flag_dpa_consent" id="flag-dpa-consent" value="1"{{ obj.getCustomer ? obj.getCustomer.isDpaConsent ? ' checked' }} i>
|
<input type="checkbox" name="flag_dpa_consent" id="flag-dpa-consent" value="1"{{ obj.getCustomer ? obj.getCustomer.isDpaConsent ? ' checked' }} >
|
||||||
<label class="switch-label">With DPA Consent</label>
|
<label class="switch-label">With DPA Consent</label>
|
||||||
<div class="form-control-feedback hide" data-field="flag_dpa_consent"></div>
|
<div class="form-control-feedback hide" data-field="flag_dpa_consent"></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<div class="col-lg-12 form-group-inner">
|
||||||
|
<div class="m-checkbox-list">
|
||||||
|
{% for customer_tag in customer_tags %}
|
||||||
|
<label class="m-checkbox">
|
||||||
|
{% if obj.getCustomer %}
|
||||||
|
<input type="checkbox" name="customer_tags[]" value="{{ customer_tag.getID() }}"{{ customer_tag.getID() in obj.getCustomer.getCustomerTags() ? ' checked' : '' }} disabled>
|
||||||
|
{{ customer_tag.getName() }}
|
||||||
|
{% else %}
|
||||||
|
<input type="checkbox" name="customer_tags[]" value="{{ customer_tag.getID() }}" disabled>
|
||||||
|
{{ customer_tag.getName() }}
|
||||||
|
{% endif %}
|
||||||
|
<span></span>
|
||||||
|
</label>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="m-form__section">
|
<div class="m-form__section">
|
||||||
|
|
@ -1370,6 +1388,18 @@ $(function() {
|
||||||
if (vdata.customer.flag_research_email === true) {
|
if (vdata.customer.flag_research_email === true) {
|
||||||
$("#flag-research-email").prop("checked", true);
|
$("#flag-research-email").prop("checked", true);
|
||||||
}
|
}
|
||||||
|
if (vdata.customer.customer_tags.length > 0) {
|
||||||
|
var checkboxes = document.getElementsByName("customer_tags[]");
|
||||||
|
for (var x = 0; checkboxes.length > x; x++)
|
||||||
|
{
|
||||||
|
if (vdata.customer.customer_tags.indexOf(checkboxes[x].value) !== -1) {
|
||||||
|
checkboxes[x].checked = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
checkboxes[x].checked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// set hidden customer id
|
// set hidden customer id
|
||||||
$("#cid").val(vdata.customer.id);
|
$("#cid").val(vdata.customer.id);
|
||||||
|
|
@ -1417,6 +1447,12 @@ $(function() {
|
||||||
$("#flag-promo-email").prop("checked", false);
|
$("#flag-promo-email").prop("checked", false);
|
||||||
$("#flag-research-sms").prop("checked", false);
|
$("#flag-research-sms").prop("checked", false);
|
||||||
$("#flag-research-email").prop("checked", false);
|
$("#flag-research-email").prop("checked", false);
|
||||||
|
|
||||||
|
var checkboxes = document.getElementsByName("customer_tags[]");
|
||||||
|
for (var x = 0; checkboxes.length > x; x++)
|
||||||
|
{
|
||||||
|
checkboxes[x].checked = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// datepicker
|
// datepicker
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue