{# SAM Progress Ring Component - Circular progress indicator (SVG) Parameters: - value: number (required) - Progress percentage (0-100) - size: number - Ring size in pixels (default: 50) - strokeWidth: number - Stroke width (default: 4) - entity: string - Entity type for color: 'users', 'cohorts', 'courses', 'success', 'warning', 'danger' - showValue: bool - Show percentage value in center (default: true) - label: string - Optional label below value Usage: {% include 'sam/_components/progress_ring.html.twig' with {value: 75, entity: 'courses'} %} {% include 'sam/_components/progress_ring.html.twig' with {value: 45, size: 80, strokeWidth: 6} %} #} {% set progressValue = value|default(0)|round %} {% set ringSize = size|default(50) %} {% set stroke = strokeWidth|default(4) %} {% set entityType = entity|default('courses') %} {# Auto-detect status color based on value if not using entity colors #} {% if entity is not defined %} {% if progressValue >= 70 %} {% set entityType = 'success' %} {% elseif progressValue >= 40 %} {% set entityType = 'warning' %} {% else %} {% set entityType = 'danger' %} {% endif %} {% endif %} {# Calculate SVG values #} {% set radius = (ringSize / 2) - (stroke / 2) - 3 %} {% set circumference = 2 * 3.14159 * radius %} {% set dashOffset = circumference - (progressValue / 100 * circumference) %}