# NGBVD Stabilization Reset Patch

This patch is a corrective/stabilization patch after the last UI and permissions changes introduced regressions.

## What it restores/fixes

1. Restores the preferred dashboard direction using the original Highcharts/Morris implementation and the polished dashboard header/buttons.
2. Restores the previous `/index/district` map view instead of the modified version that changed the expected behavior.
3. Rebuilds `/index/contact` with properly aligned contact cards, icons, and a clean inquiry form.
4. Fixes permissions not applying after save by correcting `User::hasNgbvdPermission()` to read `role_permissions.module` and `role_permissions.permission` instead of a non-existent `permission_key` column.
5. Adds a hard administrator bypass for `admin@mglsd.go.ug`, `administrator@mglsd.go.ug`, username `admin`, username `administrator`, and userrole `1`.
6. Fixes navigation permission keys so menu visibility matches the configurable permission registry.
7. Restores white/card-based form styling and prevents the data-entry forms from falling back to plain grey backgrounds.

## Important

This patch intentionally does not convert all integer IDs to UUIDs. UUID conversion should be handled as a separate database migration plan because the current database is live and relational. Doing it inside a UI hotfix can break foreign keys and historical data.

## After applying

Run:

```powershell
composer dump-autoload
php artisan optimize:clear
php artisan route:clear
php artisan config:clear
php artisan view:clear
php artisan cache:clear
```

Then test:

- `/dashboard`
- `/index/district`
- `/index/contact`
- `/dataentry`
- `/dataentry/list`
- `/roles/list`
- `/users/viewusers`

## Permissions check

After assigning permissions on `/roles/list`, verify the `role_permissions` table contains records with:

- `role_id`
- `module`
- `permission`
- `is_allowed = 1`

The application now checks those fields directly.
