NGBVD DataTables + Permissions Hotfix
====================================

Purpose
-------
This patch fixes the DataTables "Incorrect column count" alerts on dashboard, profiled cases, data entry tabs and update pages. It also implements the next phase of configurable role permissions by adding route-level permission middleware.

Key fixes
---------
1. DataTables is now only initialized on safe tables.
   - Tables with server pagination are skipped.
   - Tables with colspan/rowspan are skipped.
   - Tables whose tbody column count does not match thead are skipped.
   - DataTables errMode is set to none to prevent blocking browser alert popups.

2. Data entry whitespace reduced.
   - Smaller form card spacing.
   - More compact wizard spacing.
   - White card sections retained.

3. Permissions now have middleware enforcement.
   - New middleware: app/Http/Middleware/CheckNgbvdPermission.php
   - Registered as route middleware: ngbvd.permission
   - Key routes now use module/action permissions.

4. Super administrator bypass.
   - Users whose role is administrator/admin/super admin/system administrator, or whose userrole is 1, can access all modules.

5. Roles & permissions UI improved.
   - Module side navigation.
   - Select module/select all/clear all.
   - Role coverage display.

After applying
--------------
Run:
composer dump-autoload
php artisan optimize:clear
php artisan route:clear
php artisan config:clear
php artisan view:clear
php artisan cache:clear

If role permissions table has not been migrated yet, run on staging first:
php artisan migrate --path=database/migrations/2026_06_03_000020_create_role_permissions_table.php

Testing checklist
-----------------
/dashboard
/dataentry
/dataentry/index?id=&tab=perpetrator
/dataentry/list
/dataentry/update?id=<encoded_id>
/dataentry/update?id=<encoded_id>&tab=incidents
/users/viewusers
/roles/list
/roles/permissions/<role_id>

Important
---------
If a non-admin role is blocked, assign the required permission in Roles & Permissions. Administrator role bypasses permissions to avoid lockout during migration.
