diff --git a/web/src/components/common/ActionButtons.tsx b/web/src/components/common/ActionButtons.tsx new file mode 100644 index 0000000..3d50dde --- /dev/null +++ b/web/src/components/common/ActionButtons.tsx @@ -0,0 +1,168 @@ +/** + * ActionButtons - Reusable action buttons for tables and cards + */ + +import { Eye, Pencil, Trash2, MoreVertical, type LucideIcon } from 'lucide-react'; +import { useState, useRef, useEffect } from 'react'; +import clsx from 'clsx'; + +interface ActionButtonProps { + icon: LucideIcon; + label: string; + onClick: () => void; + variant?: 'default' | 'danger' | 'success' | 'warning'; + disabled?: boolean; +} + +const variantClasses = { + default: 'text-gray-500 hover:text-blue-600 hover:bg-blue-50', + danger: 'text-gray-500 hover:text-red-600 hover:bg-red-50', + success: 'text-gray-500 hover:text-green-600 hover:bg-green-50', + warning: 'text-gray-500 hover:text-yellow-600 hover:bg-yellow-50', +}; + +export function ActionButton({ + icon: Icon, + label, + onClick, + variant = 'default', + disabled = false, +}: ActionButtonProps) { + return ( + + ); +} + +interface ActionButtonsProps { + onView?: () => void; + onEdit?: () => void; + onDelete?: () => void; + viewLabel?: string; + editLabel?: string; + deleteLabel?: string; + className?: string; +} + +export function ActionButtons({ + onView, + onEdit, + onDelete, + viewLabel = 'Ver detalle', + editLabel = 'Editar', + deleteLabel = 'Eliminar', + className, +}: ActionButtonsProps) { + return ( +
{message}
+| + {column.header} + | + ))} +
|---|
|
+ {column.render
+ ? column.render(item, index)
+ : String((item as Record |
+ ))}
+
{description}
+ {action} +{hint}
+ )} + {error &&{error}
} +{hint}
+ )} + {error &&{error}
} +{hint}
+ )} + {error &&{error}
} +{description}
+ )} +{error}
} +{message}
+{description}
} +Gestión de incidentes de seguridad, salud y medio ambiente
-| - Folio - | -- Fecha/Hora - | -- Tipo - | -- Gravedad - | -- Descripción - | -- Estado - | -- Acciones - | -
|---|---|---|---|---|---|---|
| - {generateFolio(index)} - | -
-
- {new Date(item.fecha).toLocaleDateString()}
- {item.hora && (
-
- {item.hora}
- )}
- |
- - - {tipoLabels[item.tipo]} - - | -- - {gravedadLabels[item.gravedad]} - - | -- {item.descripcion} - | -- - {estadoLabels[item.estado]} - - | -
-
-
-
- |
-
- Asigne un investigador responsable para iniciar el proceso de investigación del - incidente. -
- -- Complete la investigación y cierre el incidente. Agregue observaciones finales si es - necesario. -
- -Gestion de presupuestos de obra
-| - Codigo - | -- Nombre - | -- Version - | -- Estado - | -- Monto Total - | -- Acciones - | -
|---|---|---|---|---|---|
| - {item.codigo} - | -- {item.nombre} - | -- v{item.version} - | -- - {estadoLabels[item.estado]} - - | -- ${item.montoTotal.toLocaleString('es-MX', { minimumFractionDigits: 2 })} - | -
-
-
-
- |
-
- ¿Esta seguro de eliminar este presupuesto? Esta accion no se puede deshacer. -
-- ¿Esta seguro de aprobar este presupuesto? Una vez aprobado, no podra ser editado. -
-Gestion de fraccionamientos y desarrollos
-| - Codigo - | -- Nombre - | -- Estado - | -- Fecha Inicio - | -- Acciones - | -
|---|---|---|---|---|
| - {item.codigo} - | -- {item.nombre} - | -- - {estadoLabels[item.estado]} - - | -- {item.fechaInicio - ? new Date(item.fechaInicio).toLocaleDateString() - : '-'} - | -
-
-
-
- |
-
- ¿Esta seguro de eliminar este fraccionamiento? Esta accion no se puede deshacer. -
-