{{--
Edit Role — docs/wireframes-v12/edit-role.html (the info box at lines 112-116
and the card at 118-354), minus everything CR-14 §0 removes.
## Shape
An `.info-box` above ONE `.card`. Inside the card, a `.form-section` per
heading — each with its `.form-section-title` and the wireframe's own icon —
and a `.card-footer` at the bottom. Fields are laid out by v12's
`.form-row.form-row-2` grids, not by Bootstrap columns, which is why no field
carries a `group-class`: the row owns the columns and `.form-group` owns its
own margin.
## The twin rule (recipe §9)
This file and roles/create.blade.php are twins. Every field is written out in
both, and neither includes a shared form partial. **A field added, removed or
renamed here must be mirrored in create.blade.php in the same commit**, and
the permission matrix is one field for that purpose even though it draws
thirty-eight boxes — it is generated from App\Support\RolePermissionMatrix on
both screens, so a module added there appears on both without either file
changing.
Both twins are in tests/Feature/TwinViewParityTest.php ('roles' dataset row),
which fetches the two screens over real authenticated GETs and compares their
rendered `name` sets and required-attribute sets. What that test does NOT
cover, and what therefore stays this docblock's job: label wording, field
order and validation-rule drift.
### What this screen has that its twin does not
* the action (`roles.update`) and the method (PUT, not POST);
* the submit label — "Update Role", where the twin says "Save Role";
* the rule source — UpdateRoleRequest, whose unique rule ignores the row
being edited and whose after() refuses the Super Admin role;
* the header wording and the breadcrumb's last crumb;
* **the info box** (edit-role.html:112-116), carrying the REAL number of
people the save will affect where the wireframe hardcodes "4 users";
* **prefills** — the role's name, its system flag and its DIRECT
permissions, where the twin is handed a fresh model and an empty list.
## This screen can never show the Super Admin role (decision D1)
RoleController::edit() answers 403 for it before anything here renders, the
listing draws no pencil on its row, UpdateRoleRequest refuses a post naming
it, and RoleService refuses it again against a fresh locked row. Four walls,
because the role behind them passes every permission check in the application
through Gate::before.
## Deliberate differences from the wireframe
Identical to the twin's, which is the point of a twin — see
roles/create.blade.php's header for the full list with its wireframe line
numbers: Role Code, Description, the Status toggle and the whole Additional
Permissions section are removed (§0.3), the matrix draws the client's ten
modules rather than the wireframe's seventeen and has no Export column
(§0.3, §0.5), Booking and Cancellation render an empty Delete cell (D7), and
there are no select-all controls because v12 draws none.
--}}
@extends('layouts.app')
@section('title', __('roles.edit_title'))
@section('breadcrumbs')
{{ trans_choice('roles.edit_notice', $role->users_count, ['count' => $role->users_count]) }}
| {{ __('roles.matrix.columns.module') }} | @foreach (\App\Support\RolePermissionMatrix::ACTIONS as $action){{ __('roles.matrix.columns.'.$action) }} | @endforeach|
|---|---|---|
| {{ __('roles.matrix.modules.'.$module['key']) }} | @foreach ($module['cells'] as $action => $permission) {{-- A null cell renders EMPTY and keeps its(decision D7): Booking and Cancellation have no Delete checkbox, and dropping the cell would shift every column after it out of line. --}} | @if ($permission !== null) {{-- The two data- attributes are how nrems-role-form.js finds a box. It never parses the label beside it, which would have made the auto-check rules one translation away from silently not firing. aria-label because the visible label for these boxes is the column header plus the row heading, and a screen reader announcing "checkbox" thirty- eight times is not a form. --}} @endif | @endforeach