@php $inputClass = 'w-full rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 px-3 py-2 text-sm text-gray-900 dark:text-white shadow-sm focus:border-primary-500 focus:ring-1 focus:ring-primary-500 transition'; $labelClass = 'block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1.5'; $statusColors = [ 'active' => 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400', 'inactive' => 'bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-400', 'suspended' => 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400', 'archived' => 'bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-400', ]; @endphp
{{-- Header --}}

Organizations Management

Create, edit, suspend organizations and manage their users and courses.

Create Organization
{{-- Search & Filters --}}
{{-- Organizations Table --}}
@forelse($organizations as $org) @empty @endforelse
Organization Type Plan Status Users Courses Actions
{{ $org['name'] }}
ID: {{ Str::limit($org['id'], 8) }}
@if($org['type']) {{ str_replace('-', ' ', ucfirst($org['type'])) }} @else @endif @if($org['plan']) {{ ucfirst($org['plan']) }} @else @endif @php $sColor = $statusColors[$org['status'] ?? ''] ?? 'bg-gray-100 text-gray-600'; @endphp {{ ucfirst($org['status'] ?? 'unknown') }} {{ $org['users_count'] }} {{ $org['courses_count'] }}
@if(($org['status'] ?? '') === 'suspended') @else @endif

No organizations found.

{{-- Create/Edit Modal --}} @if($showCreateModal || $showEditModal)

{{ $showCreateModal ? 'Create Organization' : 'Edit Organization' }}

@error('formName')

{{ $message }}

@enderror
@error('formType')

{{ $message }}

@enderror
@error('formPlan')

{{ $message }}

@enderror
{{ $showCreateModal ? 'Create' : 'Update' }}
@endif {{-- View Organization Modal --}} @if($showViewModal && $viewOrg)

Organization Details

{{-- Org info --}}

Name

{{ $viewOrg['name'] }}

Type

{{ $viewOrg['type'] ? str_replace('-', ' ', ucfirst($viewOrg['type'])) : '—' }}

Plan

@if($viewOrg['plan']){{ ucfirst($viewOrg['plan']) }}@else —@endif

Status

@php $oColor = $statusColors[$viewOrg['status'] ?? ''] ?? 'bg-gray-100 text-gray-600'; @endphp{{ ucfirst($viewOrg['status']) }}

Created

{{ $viewOrg['created_at'] }}

{{-- Users --}}

Users ({{ count($orgUsers) }})

@if(count($orgUsers) > 0)
@foreach($orgUsers as $ou)
{{ $ou['name'] }} {{ $ou['email'] }}
@php $uColor = $statusColors[$ou['status'] ?? ''] ?? 'bg-gray-100 text-gray-600'; @endphp {{ ucfirst($ou['status']) }}
@endforeach
@else

No users assigned.

@endif
{{-- Courses --}}

Courses ({{ count($orgCourses) }})

@if(count($orgCourses) > 0)
@foreach($orgCourses as $oc) @php $cColor = match($oc['status']) { 'published' => 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400', 'draft' => 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400', default => 'bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-400', }; @endphp
{{ $oc['title'] }} {{ ucfirst($oc['status']) }}
@endforeach
@else

No courses found.

@endif
@endif {{-- Suspend Confirmation Modal with Cascade Warning --}} @if($showSuspendModal)

Suspend Organization

You are about to suspend:

{{ $suspendOrgName }}

@if($suspendCoursesCount > 0)

This will automatically archive {{ $suspendCoursesCount }} published course{{ $suspendCoursesCount > 1 ? 's' : '' }}.

@endif

All users under this organization will lose access to its resources.

@endif