{% extends "layouts/base.twig" %} {% block title %}{{ translations.employee_competencies ?? 'Kompetencje pracownika' }}{% endblock %} {% block head %} {{ parent() }} {% endblock %} {% block page_heading %}

{{ translations.employee_competencies ?? 'Kompetencje pracownika' }}

{{ translations.employee_competencies_subtitle ?? '' }}

{% endblock %} {% block content %} {# ── Pre-compute stats ── #} {% set emp_ids = employee.getCompetencyIds() %} {% set total_count = competencies|length %} {% set owned_count = 0 %} {% for c in competencies %} {% if c.getId() in emp_ids %}{% set owned_count = owned_count + 1 %}{% endif %} {% endfor %} {% set missing_count = total_count - owned_count %} {% set pct = total_count > 0 ? ((owned_count / total_count) * 100)|round(1) : 0 %} {# per-section stats #} {% set sec_total = {} %} {% set sec_owned = {} %} {% for c in competencies %} {% set sid = c.getSectionId() %} {% set sec_total = sec_total|merge({(sid): (sec_total[sid] ?? 0) + 1}) %} {% if c.getId() in emp_ids %} {% set sec_owned = sec_owned|merge({(sid): (sec_owned[sid] ?? 0) + 1}) %} {% endif %} {% endfor %} {# ── KPI cards – każda klikalana i filtruje listę ── #}
{{ total_count }}
{{ translations.total_competencies ?? 'Wszystkich' }}
{{ translations.click_to_filter ?? 'Kliknij, aby filtrować' }}
{{ owned_count }}
{{ translations.owned_competencies ?? 'Posiada' }}
{{ translations.click_to_filter ?? 'Kliknij, aby filtrować' }}
{{ missing_count }}
{{ translations.missing_competencies ?? 'Brakuje' }}
{{ translations.click_to_filter ?? 'Kliknij, aby filtrować' }}
{{ pct }}%
{{ translations.completion ?? 'Ukończenie' }}
{{ translations.click_to_filter ?? 'Kliknij, aby filtrować' }}

{{ employee.getDisplayName() ?: (employee.getName() ~ ' ' ~ employee.getSurname()) }}

{{ translations.competencies_readonly_hint ?? 'Widok tylko do odczytu' }}
{{ translations.back ?? 'Wróć' }}
{# ── Filter toolbar ── #}
{# ── Competency list grouped by section ── #} {% for section in grouped_sections %} {% set sec_id = section.getId() %} {% set s_total = sec_total[sec_id] ?? 0 %} {% set s_owned = sec_owned[sec_id] ?? 0 %} {% set s_pct = s_total > 0 ? ((s_owned / s_total) * 100)|round(0) : 0 %}
{{ section.getName() }}
{{ s_owned }}/{{ s_total }}
{% for c in competencies %} {% if c.getSectionId() == sec_id %} {% set is_owned = c.getId() in emp_ids %}
{% if is_owned %} {% else %} {% endif %}
{{ c.getName() }}
{% if c.getDescription() %}
{{ c.getDescription()|slice(0, 80) }}{% if c.getDescription()|length > 80 %}...{% endif %}
{% endif %}
{% if is_owned %} {{ translations.owned ?? 'Posiada' }} {% else %} {{ translations.missing ?? 'Brak' }} {% endif %}
{% endif %} {% endfor %}
{% endfor %}

{{ translations.no_results ?? 'Brak wyników' }}

{# ── Sidebar: section progress ── #}
{{ translations.sections_progress ?? 'Postęp wg sekcji' }}
{% for section in grouped_sections %} {% set sid = section.getId() %} {% set st = sec_total[sid] ?? 0 %} {% set so = sec_owned[sid] ?? 0 %} {% set sp = st > 0 ? ((so / st) * 100)|round(0) : 0 %}
{{ section.getName() }} {{ so }}/{{ st }}
{% endfor %}
{% endblock %} {% block scripts %} {% endblock %}