@extends('layouts.app') @section('content')

{{ isset($editUser) ? 'Edit Profile' : 'Add Agent' }}

{{-- Toast Success --}} @if(session('success'))
@endif {{-- Error --}} @if(session('error'))
{{ session('error') }}
@endif {{-- Validation Errors --}} @if($errors->any())
Whoops! There were some problems with your input.
    @foreach($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif
{{ isset($editUser) ? 'Edit Profile' : 'Add Agent' }}
{{-- ┌─────────────────────────────────────────────────────┐ │ Form action is role-aware: │ │ • admin → users.save (UserManagementController) │ │ • others → profile.update.self (UserProfileController) │ └─────────────────────────────────────────────────────┘ --}} @php $isAdmin = auth()->user()->role?->role_name === 'admin'; $formAction = $isAdmin ? route('users.save') : route('profile.update.self'); @endphp
@csrf @if(isset($editUser)) @endif {{-- ── Avatar ─────────────────────────────────────────── --}}
Profile Photo
avatar

Recommended dimensions are 400 x 400 pixels.

Allowed JPG, PNG. Max size 800KB.
{{-- ── Basic Information ──────────────────────────────── --}}
Basic Information
@error('name')
{{ $message }}
@enderror
Email cannot be changed after creation. @error('email')
{{ $message }}
@enderror
@error('phone')
{{ $message }}
@enderror
{{-- Password fields only shown when creating a new user (admin only) --}} @if(!isset($editUser) && $isAdmin)
@error('password')
{{ $message }}
@enderror
@endif
{{-- ── Account Settings (Admin only) ─────────────────── --}} @if($isAdmin)
Account Settings
@error('markup')
{{ $message }}
@enderror
@error('credit_limit')
{{ $message }}
@enderror
@endif {{-- ── End Account Settings ────────────────────────────── --}} {{-- ── Address Information ────────────────────────────── --}}
Address Information
{{-- ── Submit ──────────────────────────────────────────── --}}
Cancel
@endsection @section('scripts') @endsection