feat: segregate super admin and LGU admin workflows

- Created AdminBarangayController to strictly scope barangay management to LGU boundaries
- Created AdminTenantController for LGU admins to fetch their own tenant configurations
- Updated sidebar to expose Barangays to LGU admins under the Areas menu
- Updated frontend UI to hide the City selection dropdown from LGU admins and dynamically inject their city_municipality_id
- Handled form validation issues caused by hidden required fields
- Implemented LGU dashboard routes and views
- Enforced 2 free QR code allocations on resident signup
This commit is contained in:
Azure_0_
2026-07-07 00:33:16 +08:00
committed by Verde AI
parent 6f74305e4a
commit ee72cd7211
19 changed files with 730 additions and 30 deletions

View File

@@ -16,6 +16,9 @@ class StoreTenantRequest extends FormRequest
public function rules(): array
{
$isCreate = $this->isMethod('post');
$tenant = $this->route('tenant');
$admin = $tenant ? $tenant->users()->where('role', \App\Models\User::ROLE_ADMIN)->first() : null;
$adminEmailRule = $isCreate ? 'unique:users,email' : Rule::unique('users', 'email')->ignore($admin?->id);
return [
'name' => ['required', 'string', 'max:191'],
@@ -31,9 +34,9 @@ class StoreTenantRequest extends FormRequest
'status' => ['nullable', Rule::in([Tenant::STATUS_ONBOARDING, Tenant::STATUS_ACTIVE, Tenant::STATUS_SUSPENDED])],
'timezone' => ['nullable', 'string', 'max:100'],
// Default Admin Account Info (Only required during creation)
'admin_email' => $isCreate ? ['required', 'email', 'max:191', 'unique:users,email'] : ['nullable'],
'admin_password' => $isCreate ? ['required', 'string', 'min:8'] : ['nullable'],
// Default Admin Account Info
'admin_email' => $isCreate ? ['required', 'email', 'max:191', 'unique:users,email'] : ['nullable', 'email', 'max:191', $adminEmailRule],
'admin_password' => $isCreate ? ['required', 'string', 'min:8'] : ['nullable', 'string', 'min:8'],
];
}
}