Merge branch '792-battery-facilitated-by-issue' into 'master'

Resolve "Battery Facilitated By issue"

Closes #792

See merge request jankstudio/resq!903
This commit is contained in:
Ramon Gutierrez 2024-09-24 04:40:00 +00:00
commit 83bdb5c626
2 changed files with 34 additions and 4 deletions

View file

@ -1612,6 +1612,26 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$error_array['cust_location'] = 'Invalid customer location';
}
// 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;
}
// get previously assigned hub, if any
$old_hub = $obj->getHub();
@ -1672,6 +1692,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
->setOwnershipType($owner_type)
->setCustomerLocation($cust_location)
->setInventoryCount($req->request->get('hub_inv_count', 0))
->setFacilitatedType($fac_type)
->setFacilitatedBy($fac_by)
->clearRider();
if ($user != null)

View file

@ -831,20 +831,28 @@
<div class="m-form__section">
<div class="form-group m-form__group row">
<div class="col-lg-2">
<label for="faciliateted-type">Battery Facilitated By</label>
<label for="facilitated-type">Battery 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>
{% if obj.getFacilitatedType %}
<option value="{{ key }}"{{ obj.getFacilitatedType == key ? ' selected' }}>{{ type }}</option>
{% else %}
<option value="{{ key }}">{{ type }}</option>
{% endif %}
{% endfor %}
</select>
</div>
<div class="col-lg-8">
<label for="faciliateted-by">&nbsp;</label>
<label for="facilitated-by">&nbsp;</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>
{% if obj.getFacilitatedBy %}
<option value="{{ key }}"{{ obj.getFacilitatedBy.getID == key ? ' selected' }}>{{ name }}</option>
{% else %}
<option value="{{ key }}">{{ name }}</option>
{% endif %}
{% endfor %}
</select>
</div>