@extends('layouts.app') @section('title', __('Add a user')) @section('page-title', __('Add a user')) @section('page-subtitle', __('Send an invitation by email or WhatsApp, or create the account directly.')) @section('content') @php $oldMode = old('_mode', $invitation ? 'invite' : 'invite'); $oldRole = old('role', 'user'); $oldChannels = (array) old('channels', ['email']); @endphp
{{-- Mode tabs --------------------------------------------------------- --}}
{{ __('Back to users') }}
{{-- ============================================================== --}} {{-- INVITE MODE --}} {{-- ============================================================== --}}
{{-- Form column (spans 2) --}}
@csrf

{{ __('Invitation details') }}

{{ __('A signed accept link will be generated. The recipient sets their own password on first sign-in.') }}

@error('name')
{{ $message }}
@enderror
@error('email')
{{ $message }}
@enderror

{{ __('Used to prefill a WhatsApp share link with the invitation.') }}

@error('phone')
{{ $message }}
@enderror
{{-- Channels picker --}}

{{ __('Invitation expires in 7 days. You can resend it any time from the user list.') }}

{{-- Side column: result / preview --}}
@if($invitation)
{{ __('Invitation ready') }}
{{ $invitation['mail_sent'] ? __('Email delivered') : __('Email not sent') }} @if($invitation['expires_at']) · {{ __('expires :d', ['d' => $invitation['expires_at']]) }} @endif
{{ __('Recipient') }}
{{ $invitation['name'] }}
{{ $invitation['email'] }}
{{ __('Accept link') }}
{{ __('Temporary password') }}

{{ __('Shown once. The recipient sets a new password on accept.') }}

@else
{{ __('How invitations work') }}
  • 1. {{ __('You fill in name, email, role and pick how to deliver.') }}
  • 2. {{ __('We generate a one-time accept link valid for 7 days.') }}
  • 3. {{ __('The recipient clicks, sets a password and is signed in.') }}
  • 4. {{ __('Their seat counts against your plan only after acceptance.') }}
@endif
{{-- ============================================================== --}} {{-- DIRECT MODE --}} {{-- ============================================================== --}}
@csrf

{{ __('Create account directly') }}

{{ __('Sets the password yourself. Use this when you already share credentials offline (e.g. internal staff onboarding).') }}

@error('name')
{{ $message }}
@enderror
@error('email')
{{ $message }}
@enderror
@error('password')
{{ $message }}
@enderror
{{ __('Cancel') }}
{{-- ============================================================== --}} {{-- IMPORT MODE — CSV / Excel --}} {{-- ============================================================== --}}
@csrf

{{ __('Import users from CSV or Excel') }}

{{ __('Each row becomes one active user. The file must be clean — any invalid row blocks the whole import.') }}

@if(session('error'))
{{ session('error') }}
@endif @if(session('import_errors'))
{{ __('Per-row errors') }}
@foreach(session('import_errors') as $err) @endforeach
{{ __('Row') }} {{ __('Email') }} {{ __('Errors') }}
{{ $err['line'] }} {{ $err['email'] }} {{ implode(' · ', $err['errors']) }}
@endif
@error('file')
{{ $message }}
@enderror
{{ __('Required columns') }}
name — {{ __('full name') }}
email — {{ __('unique, valid format') }}
roleuser {{ __('or') }} tenant_admin
password — {{ __('optional, min 8 chars (auto-generated if empty)') }}
is_active1 {{ __('or') }} 0 ({{ __('default 1') }})
{{ __('Download CSV template') }}
{{ __('How import works') }}
  • 1. {{ __('We validate every row before creating anything.') }}
  • 2. {{ __('If any row is invalid the whole import is cancelled — fix the file and retry.') }}
  • 3. {{ __('Seat quotas are enforced for the whole batch — not per row.') }}
  • 4. {{ __('Imported users are active immediately and can sign in with the password from the file (or the auto-generated one).') }}
@endsection