Add inventory count to job order. Add saving of inventory count when assigning hub. #759
This commit is contained in:
parent
236819d951
commit
4f13114649
3 changed files with 35 additions and 2 deletions
|
|
@ -429,6 +429,12 @@ class JobOrder
|
|||
*/
|
||||
protected $cust_location;
|
||||
|
||||
// inventory count of hub at time of hub assignment
|
||||
/**
|
||||
* @ORM\Column(type="smallint")
|
||||
*/
|
||||
protected $inventory_count;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_create = new DateTime();
|
||||
|
|
@ -453,6 +459,8 @@ class JobOrder
|
|||
$this->phone_mobile = '';
|
||||
|
||||
$this->will_wait = WillingToWaitContent::WILLING_TO_WAIT;
|
||||
|
||||
$this->inventory_count = 0;
|
||||
}
|
||||
|
||||
public function getID()
|
||||
|
|
@ -1217,4 +1225,16 @@ class JobOrder
|
|||
{
|
||||
return $this->cust_location;
|
||||
}
|
||||
|
||||
public function setInventoryCount($inventory_count)
|
||||
{
|
||||
$this->inventory_count = $inventory_count;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getInventoryCount()
|
||||
{
|
||||
return $this->inventory_count;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1005,7 +1005,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setCallerClassification($caller_class)
|
||||
->setEmergencyType($etype)
|
||||
->setOwnershipType($owner_type)
|
||||
->setCustomerLocation($cust_location);
|
||||
->setCustomerLocation($cust_location)
|
||||
->setInventoryCount($req->request->get('hub_inv_count', 0));
|
||||
|
||||
// validate
|
||||
$errors = $this->validator->validate($obj);
|
||||
|
|
@ -1637,6 +1638,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
->setEmergencyType($etype)
|
||||
->setOwnershipType($owner_type)
|
||||
->setCustomerLocation($cust_location)
|
||||
->setInventoryCount($req->request->get('hub_inv_count', 0))
|
||||
->clearRider();
|
||||
|
||||
if ($user != null)
|
||||
|
|
|
|||
|
|
@ -794,7 +794,7 @@
|
|||
</tr>
|
||||
|
||||
{% 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.getBranch }}</td>
|
||||
<!--<td class="text-right">{{ hub.distance ? hub.distance : '-' }}</td>
|
||||
|
|
@ -1377,6 +1377,9 @@ $(function() {
|
|||
{% if mode in ['update-processing', 'update-reassign-hub'] %}
|
||||
// add selected hub to data
|
||||
fields['hub'] = selectedHub;
|
||||
|
||||
// add inventory count of selected hub to data
|
||||
fields['hub_inv_count'] = selectedHubInvCount;
|
||||
{% endif %}
|
||||
|
||||
{% if mode in ['update-assigning', 'update-reassign-rider'] %}
|
||||
|
|
@ -1840,11 +1843,13 @@ $(function() {
|
|||
|
||||
{% if mode in ['update-processing', 'update-reassign-hub'] %}
|
||||
var selectedHub = '{{ obj.getHub ? obj.getHub.getID : "" }}';
|
||||
var selectedHubInvCount = 0;
|
||||
|
||||
$("#hubs-table tbody tr").click(function() {
|
||||
var id = $(this).data('id');
|
||||
var lat = $(this).data('lat');
|
||||
var lng = $(this).data('lng');
|
||||
var inv_count = $(this).data('invcount');
|
||||
|
||||
if (id != selectedHub) {
|
||||
// highlight this row, set hub value
|
||||
|
|
@ -1855,6 +1860,9 @@ $(function() {
|
|||
// set value
|
||||
selectedHub = id;
|
||||
|
||||
// set value for inventory count
|
||||
selectedHubInvCount = inv_count;
|
||||
|
||||
// center the map
|
||||
osm_hmap.flyTo(L.latLng(lat, lng));
|
||||
} else {
|
||||
|
|
@ -1863,6 +1871,9 @@ $(function() {
|
|||
|
||||
// remove id value
|
||||
selectedHub = '';
|
||||
|
||||
// reset inventory count
|
||||
selectedHubInvCount = 0;
|
||||
}
|
||||
});
|
||||
{% endif %}
|
||||
|
|
|
|||
Loading…
Reference in a new issue