Add inventory count to job order. Add saving of inventory count when assigning hub. #759

This commit is contained in:
Korina Cordero 2023-08-24 07:29:06 +00:00
parent 236819d951
commit 4f13114649
3 changed files with 35 additions and 2 deletions

View file

@ -429,6 +429,12 @@ class JobOrder
*/ */
protected $cust_location; protected $cust_location;
// inventory count of hub at time of hub assignment
/**
* @ORM\Column(type="smallint")
*/
protected $inventory_count;
public function __construct() public function __construct()
{ {
$this->date_create = new DateTime(); $this->date_create = new DateTime();
@ -453,6 +459,8 @@ class JobOrder
$this->phone_mobile = ''; $this->phone_mobile = '';
$this->will_wait = WillingToWaitContent::WILLING_TO_WAIT; $this->will_wait = WillingToWaitContent::WILLING_TO_WAIT;
$this->inventory_count = 0;
} }
public function getID() public function getID()
@ -1217,4 +1225,16 @@ class JobOrder
{ {
return $this->cust_location; return $this->cust_location;
} }
public function setInventoryCount($inventory_count)
{
$this->inventory_count = $inventory_count;
return $this;
}
public function getInventoryCount()
{
return $this->inventory_count;
}
} }

View file

@ -1005,7 +1005,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
->setCallerClassification($caller_class) ->setCallerClassification($caller_class)
->setEmergencyType($etype) ->setEmergencyType($etype)
->setOwnershipType($owner_type) ->setOwnershipType($owner_type)
->setCustomerLocation($cust_location); ->setCustomerLocation($cust_location)
->setInventoryCount($req->request->get('hub_inv_count', 0));
// validate // validate
$errors = $this->validator->validate($obj); $errors = $this->validator->validate($obj);
@ -1637,6 +1638,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
->setEmergencyType($etype) ->setEmergencyType($etype)
->setOwnershipType($owner_type) ->setOwnershipType($owner_type)
->setCustomerLocation($cust_location) ->setCustomerLocation($cust_location)
->setInventoryCount($req->request->get('hub_inv_count', 0))
->clearRider(); ->clearRider();
if ($user != null) if ($user != null)

View file

@ -794,7 +794,7 @@
</tr> </tr>
{% for hub in hubs %} {% for hub in hubs %}
<tr data-lat="{{ hub.hub.getCoordinates.getLatitude }}" data-lng="{{ hub.hub.getCoordinates.getLongitude }}" data-id="{{ hub.hub.getID }}"{{ obj.getHub and obj.getHub.getID == hub.hub.getID ? ' class="m-table__row--primary"' }}> <tr data-lat="{{ hub.hub.getCoordinates.getLatitude }}" data-lng="{{ hub.hub.getCoordinates.getLongitude }}" data-id="{{ hub.hub.getID }}" data-invcount={{ hub.inventory }}{{ obj.getHub and obj.getHub.getID == hub.hub.getID ? ' class="m-table__row--primary"' }}>
<td>{{ hub.hub.getName }}</td> <td>{{ hub.hub.getName }}</td>
<td>{{ hub.hub.getBranch }}</td> <td>{{ hub.hub.getBranch }}</td>
<!--<td class="text-right">{{ hub.distance ? hub.distance : '-' }}</td> <!--<td class="text-right">{{ hub.distance ? hub.distance : '-' }}</td>
@ -1377,6 +1377,9 @@ $(function() {
{% if mode in ['update-processing', 'update-reassign-hub'] %} {% if mode in ['update-processing', 'update-reassign-hub'] %}
// add selected hub to data // add selected hub to data
fields['hub'] = selectedHub; fields['hub'] = selectedHub;
// add inventory count of selected hub to data
fields['hub_inv_count'] = selectedHubInvCount;
{% endif %} {% endif %}
{% if mode in ['update-assigning', 'update-reassign-rider'] %} {% if mode in ['update-assigning', 'update-reassign-rider'] %}
@ -1840,11 +1843,13 @@ $(function() {
{% if mode in ['update-processing', 'update-reassign-hub'] %} {% if mode in ['update-processing', 'update-reassign-hub'] %}
var selectedHub = '{{ obj.getHub ? obj.getHub.getID : "" }}'; var selectedHub = '{{ obj.getHub ? obj.getHub.getID : "" }}';
var selectedHubInvCount = 0;
$("#hubs-table tbody tr").click(function() { $("#hubs-table tbody tr").click(function() {
var id = $(this).data('id'); var id = $(this).data('id');
var lat = $(this).data('lat'); var lat = $(this).data('lat');
var lng = $(this).data('lng'); var lng = $(this).data('lng');
var inv_count = $(this).data('invcount');
if (id != selectedHub) { if (id != selectedHub) {
// highlight this row, set hub value // highlight this row, set hub value
@ -1855,6 +1860,9 @@ $(function() {
// set value // set value
selectedHub = id; selectedHub = id;
// set value for inventory count
selectedHubInvCount = inv_count;
// center the map // center the map
osm_hmap.flyTo(L.latLng(lat, lng)); osm_hmap.flyTo(L.latLng(lat, lng));
} else { } else {
@ -1863,6 +1871,9 @@ $(function() {
// remove id value // remove id value
selectedHub = ''; selectedHub = '';
// reset inventory count
selectedHubInvCount = 0;
} }
}); });
{% endif %} {% endif %}