Merge branch '759-add-inventory-column-to-job-order-details-report' into '746-resq-2-0-final'

Resolve "Add inventory column to Job Order Details Report"

See merge request jankstudio/resq!873
This commit is contained in:
Ramon Gutierrez 2023-09-05 20:00:36 +00:00
commit 8c11ec9e8f
No known key found for this signature in database
4 changed files with 40 additions and 2 deletions

View file

@ -813,6 +813,7 @@ class ReportController extends Controller
'Plate Number', 'Plate Number',
'SKU', 'SKU',
'Serial Number', 'Serial Number',
'Inventory',
'Invoice/DR No.', 'Invoice/DR No.',
'Existing Battery', 'Existing Battery',
'Rider Name', 'Rider Name',
@ -1932,6 +1933,9 @@ class ReportController extends Controller
$fac_hub_coord_lat = $fac_hub->getCoordinates()->getLatitude(); $fac_hub_coord_lat = $fac_hub->getCoordinates()->getLatitude();
} }
// get inventory count
$inventory = $jo->getInventoryCount();
// find date and time when JO was assigned a hub // find date and time when JO was assigned a hub
$datetime_hub_assign_jo = ''; $datetime_hub_assign_jo = '';
$date_hub_assign_jo = ''; $date_hub_assign_jo = '';
@ -2254,6 +2258,7 @@ class ReportController extends Controller
$plate_number, $plate_number,
$sku, $sku,
$serial, $serial,
$inventory,
$jo->getORName(), $jo->getORName(),
$existing_batt, $existing_batt,
$rider_name, $rider_name,

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

@ -1009,7 +1009,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);
@ -1641,6 +1642,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 %}