@model PlanTempus.Application.Features.Employees.Components.PermissionsMatrixViewModel

<swp-permissions-matrix>
    <table>
        <thead>
            <tr>
                <th localize="employees.permissions.title">Rettighed</th>
                @foreach (var role in Model.Roles)
                {
                    <th>@role.Name</th>
                }
            </tr>
        </thead>
        <tbody>
            @foreach (var permission in Model.Permissions)
            {
                <tr>
                    <td>
                        <span class="permission-name">
                            <i class="ph @permission.Icon"></i>
                            @permission.Name
                        </span>
                    </td>
                    @foreach (var role in Model.Roles)
                    {
                        <td>
                            @if (permission.RoleAccess.TryGetValue(role.Key, out var hasAccess) && hasAccess)
                            {
                                <i class="ph ph-check-circle check"></i>
                            }
                            else
                            {
                                <i class="ph ph-minus no-access"></i>
                            }
                        </td>
                    }
                </tr>
            }
        </tbody>
    </table>
</swp-permissions-matrix>
