feat: add allocated status and project allocation to unit management
- Updated dashboard to display allocated units alongside deployed and benched units. - Introduced a quick-info modal for units, showing detailed information including calibration status, project allocation, and upcoming jobs. - Enhanced fleet calendar with a new quick-info modal for units, allowing users to view unit details without navigating away. - Modified devices table to include allocated status and visual indicators for allocated units. - Added allocated filter option in the roster view for better unit management. - Implemented backend migration to add 'allocated' and 'allocated_to_project_id' columns to the roster table. - Updated unit detail view to reflect allocated status and allow for project allocation input.
This commit is contained in:
@@ -500,6 +500,8 @@ def get_roster_unit(unit_id: str, db: Session = Depends(get_db)):
|
||||
"deployed": unit.deployed,
|
||||
"retired": unit.retired,
|
||||
"out_for_calibration": unit.out_for_calibration or False,
|
||||
"allocated": getattr(unit, 'allocated', False) or False,
|
||||
"allocated_to_project_id": getattr(unit, 'allocated_to_project_id', None) or "",
|
||||
"note": unit.note or "",
|
||||
"project_id": unit.project_id or "",
|
||||
"location": unit.location or "",
|
||||
@@ -532,6 +534,8 @@ async def edit_roster_unit(
|
||||
deployed: str = Form(None),
|
||||
retired: str = Form(None),
|
||||
out_for_calibration: str = Form(None),
|
||||
allocated: str = Form(None),
|
||||
allocated_to_project_id: str = Form(None),
|
||||
note: str = Form(""),
|
||||
project_id: str = Form(None),
|
||||
location: str = Form(None),
|
||||
@@ -574,6 +578,7 @@ async def edit_roster_unit(
|
||||
deployed_bool = deployed in ['true', 'True', '1', 'yes'] if deployed else False
|
||||
retired_bool = retired in ['true', 'True', '1', 'yes'] if retired else False
|
||||
out_for_calibration_bool = out_for_calibration in ['true', 'True', '1', 'yes'] if out_for_calibration else False
|
||||
allocated_bool = allocated in ['true', 'True', '1', 'yes'] if allocated else False
|
||||
|
||||
# Convert port strings to integers
|
||||
slm_tcp_port_int = int(slm_tcp_port) if slm_tcp_port and slm_tcp_port.strip() else None
|
||||
@@ -611,6 +616,8 @@ async def edit_roster_unit(
|
||||
unit.deployed = deployed_bool
|
||||
unit.retired = retired_bool
|
||||
unit.out_for_calibration = out_for_calibration_bool
|
||||
unit.allocated = allocated_bool
|
||||
unit.allocated_to_project_id = allocated_to_project_id if allocated_bool else None
|
||||
unit.note = note
|
||||
unit.project_id = project_id
|
||||
unit.location = location
|
||||
|
||||
Reference in New Issue
Block a user