@extends('user.layouts') @section('title', 'All Agents') @section('header') {{-- ========================================================= DATATABLE CSS ========================================================== --}} @endsection @section('content')
{{-- ========================================================= PAGE HEADER ========================================================== --}} {{-- ========================================================= FILTER CARD ========================================================== --}}
{{-- FILTER HEADER --}}
Search & Filter

Find agents using name, phone, code, registration, business or account status

{{-- FILTERS --}}
{{-- FROM DATE --}}
{{-- TO DATE --}}
{{-- AGENT NAME --}}
{{-- PHONE --}}
{{-- AGENT CODE --}}
{{-- REGISTRATION TYPE --}}
{{-- BUSINESS STATUS --}}
{{-- ACCOUNT STATUS --}}
{{-- BUTTONS --}}
{{-- ========================================================= AGENTS TABLE ========================================================== --}}
{{-- Registration date & time --}} @foreach ($user_details as $user) @php /* |-------------------------------------------------------------------------- | REGISTRATION TYPE |-------------------------------------------------------------------------- */ $isSelfRegistration = !isset($user->referral_agent_code) && !isset($user->referral_jilla_code); $registrationType = $isSelfRegistration ? 'Self registration' : 'Agent registration'; /* |-------------------------------------------------------------------------- | BUSINESS STATUS |-------------------------------------------------------------------------- */ $hasBusiness = isset($check_vendor[$user->id]); $businessStatus = $hasBusiness ? 'Registered' : 'Not Registered'; /* |-------------------------------------------------------------------------- | ACCOUNT STATUS |-------------------------------------------------------------------------- | | Existing code: | is_active == 0 => UNBLOCK | Otherwise => BLOCK | */ $isBlocked = $user->is_active == 0; $accountStatus = $isBlocked ? 'Blocked' : 'Active'; /* |-------------------------------------------------------------------------- | INITIAL |-------------------------------------------------------------------------- */ $initial = !empty($user->name) ? strtoupper( substr( trim($user->name), 0, 1 ) ) : 'A'; @endphp {{-- ================================================= SN ================================================== --}} {{-- ================================================= NAME ================================================== --}} {{-- ================================================= PHONE ================================================== --}} {{-- ================================================= AGENT CODE ================================================== --}} {{-- ================================================= REGISTRATION TYPE ================================================== --}} {{-- ================================================= BUSINESS ================================================== --}} {{-- ================================================= ACCOUNT STATUS ================================================== --}} @php $registeredAt = $user->created_at ? $user->created_at->copy()->timezone('Asia/Kolkata') : null; @endphp {{-- ================================================= ACTION ================================================== --}} @endforeach
SN NAME PHONE NO AGENT CODE TYPE BUSINESS STATUSREGISTERED ON ACTION
{{ $loop->iteration }}
{{ $initial }}

{{ $user->name ?? '-' }}

{{ $user->phone_number ?? '-' }}
{{ $user->phone_number ?? '-' }} {{ $user->agent_code ?? '-' }} @if ($isSelfRegistration) Self registration @else Agent registration @endif @if (!$hasBusiness) Not Registered @else View Business {{-- Hidden searchable text --}} Registered @endif @if ($isBlocked) Blocked @else Active @endif @if($registeredAt)
{{ $registeredAt->format('d-m-Y') }}
{{ $registeredAt->format('h:i A') }}
@else N/A @endif
@if ($isBlocked) Unblock @else Block @endif
{{-- ========================================================= BLOCK / UNBLOCK MODAL ========================================================== --}}
@endsection @section('footer') {{-- ========================================================= JQUERY ========================================================== --}} {{-- ========================================================= DATATABLE CORE ========================================================== --}} {{-- ========================================================= EXPORT DEPENDENCIES ========================================================== --}} {{-- ========================================================= DATATABLE BUTTONS ========================================================== --}} {{-- ========================================================= BLOCK / UNBLOCK ========================================================== --}} {{-- ========================================================= PREVENT DOUBLE SUBMIT ========================================================== --}} {{-- ========================================================= DATATABLE ========================================================== --}} @endsection