<%- include('../partials/head', { title }) %>
<div class="space-y-6"><% roles.forEach(role => { const set = new Set(assigned.filter(a=>a.role_id===role.id).map(a=>a.permission_id)); %><form method="post" action="/roles/<%= role.id %>/permissions" class="panel"><input type="hidden" name="_csrf" value="<%= csrfToken %>"><div class="panel-header"><div><h2 class="font-black"><%= role.name_fa %></h2><code class="text-xs" dir="ltr"><%= role.code %></code></div><button class="btn-primary">ذخیره مجوزهای نقش</button></div><div class="grid gap-3 p-5 sm:grid-cols-2 xl:grid-cols-4"><% permissions.forEach(permission => { %><label class="flex items-start gap-3 rounded-xl border border-slate-200 p-3 dark:border-slate-800"><input type="checkbox" name="permissions" value="<%= permission.code %>" <%= set.has(permission.id) ? 'checked' : '' %>><span><b class="block text-sm"><%= permission.name_fa %></b><span class="text-xs text-slate-500"><%= permission.module %> — <span dir="ltr"><%= permission.code %></span></span></span></label><% }) %></div></form><% }) %></div>
<%- include('../partials/footer') %>

