Skip to main content

Overview

GIMA’s asset management system provides comprehensive tracking of physical assets throughout their lifecycle, from acquisition to decommissioning. Assets are tracked with detailed metadata, location information, maintenance history, and real-time status updates.

Asset States

Assets in GIMA can exist in one of four states, defined by the EstadoActivo enum:

Operativo

OperationalAsset is functioning normally and available for use. This is the default state for active assets.

En Mantenimiento

Under MaintenanceAsset is currently undergoing scheduled or corrective maintenance and temporarily unavailable.

Fuera de Servicio

Out of ServiceAsset is non-functional or unavailable but not permanently removed. May require major repair.

Baja

DecommissionedAsset has been permanently removed from service, sold, or disposed of.

Estado Activo Enum

From app/Enums/EstadoActivo.php:source/app/Enums/EstadoActivo.php:
enum EstadoActivo : string
{
    case OPERATIVO = 'operativo';
    case MANTENIMiENTO = 'mantenimiento';
    case FUERA_SERVICIO = 'fuera_servicio';
    case BAJA = 'baja';

    public function label(): string
    {
        return match($this) {
            self::OPERATIVO => 'Operativo',
            self::MANTENIMiENTO => 'En mantenimiento',
            self::FUERA_SERVICIO => 'Fuera de Servicio',
            self::BAJA => 'Dado de baja'
        };
    }
}

Asset Lifecycle

1

Acquisition & Registration

Who: Admin or SupervisorNew assets are registered in the system with:
  • Article type (Mobiliario or Equipo)
  • Physical location (Building, Floor, Room)
  • Initial value
  • Initial state (typically Operativo)
2

Operational Use

State: OperativoAsset is in active use:
  • Can be assigned to scheduled maintenance
  • Can receive fault reports from any user
  • Location can be updated if moved
  • Tracked for usage patterns
3

Maintenance Cycle

State: En MantenimientoAsset undergoes maintenance:
  • Temporarily unavailable for use
  • Assigned to técnicos
  • Spare parts usage tracked
  • Activities logged in maintenance sessions
4

Return to Service or Escalation

Outcomes:
  • Success: Returns to Operativo state
  • Requires More Work: Remains in Mantenimiento
  • Major Issue: Moved to Fuera de Servicio
5

Decommissioning

State: BajaAsset is permanently removed:
  • No longer available for maintenance
  • Historical data retained
  • Audit trail preserved

Asset Model Structure

From app/Models/Activo.php:source/app/Models/Activo.php:
class Activo extends Model
{
    protected $table = 'activos';
    
    protected $fillable = [
        'articulo_id',    // Link to article type
        'ubicacion_id',   // Physical location
        'estado',         // Current state (EstadoActivo enum)
        'valor',          // Asset value
    ];
    
    protected $casts = [
        'estado' => EstadoActivo::class,  // Auto-cast to enum
        'valor' => 'float',
    ];
}
The estado field is automatically cast to the EstadoActivo enum, providing type safety and IDE autocomplete.

Asset Relationships

Article Type

Each asset belongs to an article type (Mobiliario or Equipo):
// Asset -> Article relationship
public function articulo(): BelongsTo
{
    return $this->belongsTo(Articulos::class, 'articulo_id');
}
From app/Enums/TipoArticulo.php:source/app/Enums/TipoArticulo.php:
enum TipoArticulo: string
{
    case MOBILIARIO = 'mobiliario';  // Furniture
    case EQUIPO = 'equipo';          // Equipment
}
  • Mobiliario: Desks, chairs, cabinets, etc.
  • Equipo: Computers, printers, machinery, etc.

Physical Location

Assets are assigned to specific physical locations:
// Asset -> Location relationship
public function ubicacion(): BelongsTo
{
    return $this->belongsTo(Ubicacion::class, 'ubicacion_id');
}
From app/Models/Ubicacion.php:source/app/Models/Ubicacion.php:
class Ubicacion extends Model
{
    protected $fillable = [
        'edificio',  // Building name
        'piso',      // Floor number
        'salon'      // Room/Office identifier
    ];
    
    // A location can have many assets
    public function activos(): HasMany
    {
        return $this->hasMany(Activo::class, 'ubicacion_id');
    }
}

Maintenance Records

Assets maintain a complete history of maintenance activities:
// Asset -> Maintenance relationship (one-to-many)
public function mantenimientos(): HasMany
{
    return $this->hasMany(Mantenimiento::class, 'activo_id');
}
Use eager loading to avoid N+1 queries when retrieving assets with maintenance history:
$activos = Activo::with('mantenimientos')->get();

Maintenance Calendar

Scheduled maintenance is tracked through the calendar:
// Asset -> Maintenance Calendar relationship
public function calendarioMantenimientos(): HasMany
{
    return $this->hasMany(CalendarioMantenimiento::class, 'activo_id');
}

Fault Reports

Users can submit fault reports for assets:
// Asset -> Reports relationship
public function reportes(): HasMany
{
    return $this->hasMany(Reporte::class, 'activo_id');
}

Asset Tracking Example

Retrieving complete asset information with relationships:
// Get asset with all related data
$activo = Activo::with([
    'articulo',                   // Article type
    'ubicacion',                  // Physical location
    'mantenimientos.supervisor',  // Maintenance records with supervisor
    'mantenimientos.tecnicoPrincipal', // Assigned technician
    'reportes.usuario',           // Fault reports with submitter
    'calendarioMantenimientos.tecnicoAsignado' // Scheduled maintenance
])->findOrFail($id);

return response()->json([
    'id' => $activo->id,
    'tipo' => $activo->articulo->tipo,
    'estado' => $activo->estado->label(),
    'ubicacion' => [
        'edificio' => $activo->ubicacion->edificio,
        'piso' => $activo->ubicacion->piso,
        'salon' => $activo->ubicacion->salon,
    ],
    'valor' => $activo->valor,
    'mantenimientos_count' => $activo->mantenimientos->count(),
    'reportes_pendientes' => $activo->reportes
        ->where('estado', 'abierto')
        ->count(),
]);

State Transitions

Valid State Changes

Updating Asset State

// Transition asset to maintenance
$activo = Activo::find($id);
$activo->estado = EstadoActivo::MANTENIMiENTO;
$activo->save();

// Check current state
if ($activo->estado === EstadoActivo::OPERATIVO) {
    // Asset is operational
}

Asset Filtering and Reporting

Filter by State

// Get all operational assets
$operativos = Activo::where('estado', EstadoActivo::OPERATIVO)->get();

// Get assets requiring attention
$atencion = Activo::whereIn('estado', [
    EstadoActivo::MANTENIMiENTO,
    EstadoActivo::FUERA_SERVICIO
])->get();

Filter by Location

// Get all assets in a specific building
$activos = Activo::whereHas('ubicacion', function ($query) use ($edificio) {
    $query->where('edificio', $edificio);
})->get();

Asset Value Tracking

// Calculate total asset value by state
$valorOperativo = Activo::where('estado', EstadoActivo::OPERATIVO)
    ->sum('valor');

$valorTotal = Activo::whereNot('estado', EstadoActivo::BAJA)
    ->sum('valor');

Permissions Required

View Assets

Permission: ver catalogo activosRoles: All roles (Admin, Supervisor, Técnico, Reporter)Read-only access to asset catalog

Manage Assets

Permission: gestionar activosRoles: Admin, SupervisorCreate, update, and delete assets

Best Practices

  • Always validate state transitions in your business logic
  • Log state changes for audit purposes
  • Update asset state automatically when maintenance is completed
  • Never delete assets; use the BAJA state instead
  • Keep location information up to date
  • Use consistent naming conventions for buildings and rooms
  • Consider barcode/QR code integration for physical verification
  • Track location history for mobile assets
  • Record acquisition cost in the valor field
  • Consider depreciation in reporting
  • Update value after major repairs or upgrades
  • Separate asset value from maintenance costs
  • Use eager loading for related models
  • Index foreign keys and state columns
  • Cache frequently accessed asset lists
  • Paginate large asset queries

Integration with Maintenance

Assets are central to the maintenance workflow:
// Create maintenance record for an asset
$mantenimiento = Mantenimiento::create([
    'activo_id' => $activo->id,
    'supervisor_id' => auth()->id(),
    'tipo' => TipoMantenimiento::PREVENTIVO,
    'estado' => EstadoMantenimiento::PENDIENTE,
    'descripcion' => 'Mantenimiento preventivo trimestral',
    'fecha_apertura' => now(),
]);

// Update asset state
$activo->estado = EstadoActivo::MANTENIMiENTO;
$activo->save();

Next Steps

Maintenance Types

Learn about maintenance workflows

Roles & Permissions

Understand access control

API Reference

View asset API endpoints

Build docs developers (and LLMs) love