Equipment Selection
The equipment selection process uses a hierarchical filtering system to help you find the specific equipment you need to inspect.Understanding the Hierarchy
The system organizes equipment using a four-level hierarchy:This hierarchical approach prevents confusion and ensures equipment is inspected by the appropriate personnel in the correct organizational context.
Selection Process
Follow these steps to select equipment for inspection:Select División (Division)
Start by selecting a division from the first dropdown.Data Source: The divisions are loaded from
/api/divisiones/ when the form initializes.What it represents: The highest level of organizational structure, typically representing major departments or production lines.If the dropdown is empty or not loading, check that:
- You’re logged in
- The API server is accessible
- Your network connection is stable
Select Área (Area)
After choosing a division, select an area from the second dropdown.Data Source: Areas are loaded from
/api/areas/Filtering: The dropdown automatically filters to show only areas that belong to your selected division.What it represents: A subdivision within the division, often representing specific production zones or functional areas.Select Zona (Zone)
With a division and area selected, choose a zone from the third dropdown.Data Source: Zones are loaded from
/api/zonas/Filtering: Shows only zones within the selected area.What it represents: A specific physical location or sub-area within the broader area.Automatic Field Population
Once you select an equipment item, the form automatically populates related fields:Ubicación Física (Physical Location)
This field displays the physical location description from the equipment record.- Source: Equipment data’s
ubicacionproperty - Display: Read-only text field
- Purpose: Confirms you’re at the correct physical location
Categoría del Equipo (Equipment Category)
This field shows the equipment’s category classification.- Source: Equipment data’s
categoriaproperty - Display: Read-only text field
- Critical Function: Triggers the loading of category-specific inspection questions
Dynamic Question Loading
The equipment selection directly impacts what questions appear in your inspection form:Questions Fetched
The system makes an API call to
/api/preguntas/[categoria]/ to fetch category-specific questions.Error Handling
If questions fail to load:- Console Message: “Error cargando preguntas” (Error loading questions)
- Possible Causes:
- Network connectivity issues
- Invalid category value
- API endpoint unavailable
- No questions defined for this category
If you encounter this error, try:
- Reselecting the equipment
- Refreshing the page
- Checking with your administrator that questions exist for this equipment category
Pre-selecting Equipment via URL
You can bypass the manual selection process by using a URL parameter.URL Parameter Syntax
How It Works
Parse URL Parameter
On form load, the system checks for the
equipo query parameter using useSearchParams().Fetch Equipment Data
If found, it fetches full equipment details from
/api/equipos/ and finds the matching equipment by ID.Auto-populate Hierarchy
The form automatically fills in:
- División: From equipment’s
division_id - Área: From equipment’s
area_id - Zona: From equipment’s
zona_id - Equipo: The equipment ID from the URL
Use Cases for URL Parameters
QR Code Integration: Attach QR codes to equipment that encode the inspection URL with the equipment ID. Technicians can scan the code to instantly load the correct inspection form.Equipment Management Links: Link directly from equipment databases or CMMS systems.Scheduled Inspections: Include direct links in inspection schedules or work orders.Bookmarks: Save frequently inspected equipment as browser bookmarks.
Example Workflow
- Generate QR code with URL:
https://your-site.com/?equipo=456 - Attach QR code to Equipment #456
- Technician scans QR code on mobile device
- Inspection form opens with Equipment #456 pre-selected
- All hierarchy fields and questions automatically loaded
- Technician can immediately begin inspection
Data Loading Sequence
Understanding the data loading sequence helps troubleshoot issues:On Form Mount (useEffect)
- ✅ Set mounted state to
true - ✅ Check for user authentication in localStorage
- ✅ Set API base URL:
http://10.107.194.110/insp/ - ✅ Initialize date and time fields with current values
Parallel API Calls (Promise.all)
- ✅ Fetch divisiones (divisions)
- ✅ Fetch areas (areas)
- ✅ Fetch zonas (zones)
- ✅ Fetch equipos (equipment)
URL Parameter Handling
- ✅ Check for
?equipo=parameter - ✅ If found, fetch equipment details
- ✅ Auto-populate hierarchy dropdowns
- ✅ Fetch category-specific questions
All API calls include error handling with
.catch() that returns empty arrays [] to prevent the form from breaking if an endpoint fails.Troubleshooting Equipment Selection
Dropdowns Are Empty
Possible Causes:- API endpoints not responding
- Network connectivity issues
- Authentication problems
- API server is down
- Check browser console for API errors
- Verify you’re logged in (check for localStorage
usuario_inspeccion) - Refresh the page
- Contact system administrator
Equipment Doesn’t Show Expected Options
Possible Causes:- Equipment not assigned to selected zone
- Data hierarchy mismatch in database
- Filtering logic excluding equipment
- Verify with administrator that equipment is properly assigned
- Check equipment records in the database
- Try selecting different zone/area/division combinations
Questions Don’t Load After Selecting Equipment
Error Message: “Error cargando preguntas” Possible Causes:- Equipment has no category assigned
- No questions exist for this category
/api/preguntas/[categoria]/endpoint error
- Check that equipment has a valid
categoriavalue - Verify questions exist for this category in the database
- Check browser console for specific API error
- Contact administrator to add questions for this category
URL Parameter Doesn’t Work
Error Message: “Error cargando equipo” Possible Causes:- Invalid equipment ID
- Equipment doesn’t exist
- API call failed
- Verify the equipment ID is correct
- Check that equipment exists in
/api/equipos/ - Try accessing the form without parameters and selecting manually
Best Practices
For frequent inspections: Use URL parameters with equipment IDs to save time and reduce selection errors.
Verify location: Always check the “Ubicación Física” field after selection to confirm you’re inspecting the correct equipment.
Next Steps
After selecting your equipment:- Return to Inspection Form to complete the inspection
- Learn how to Submit Inspections
