@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
========================================================== --}}
| SN |
NAME |
PHONE NO |
AGENT CODE |
TYPE |
BUSINESS |
STATUS |
{{-- Registration date & time --}}
REGISTERED ON |
ACTION |
@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
================================================== --}}
|
{{ $loop->iteration }}
|
{{-- =================================================
NAME
================================================== --}}
{{ $initial }}
{{ $user->name ?? '-' }}
{{ $user->phone_number ?? '-' }}
|
{{-- =================================================
PHONE
================================================== --}}
{{ $user->phone_number ?? '-' }}
|
{{-- =================================================
AGENT CODE
================================================== --}}
{{ $user->agent_code ?? '-' }}
|
{{-- =================================================
REGISTRATION TYPE
================================================== --}}
@if ($isSelfRegistration)
Self registration
@else
Agent registration
@endif
|
{{-- =================================================
BUSINESS
================================================== --}}
@if (!$hasBusiness)
Not Registered
@else
View Business
{{-- Hidden searchable text --}}
Registered
@endif
|
{{-- =================================================
ACCOUNT STATUS
================================================== --}}
@if ($isBlocked)
Blocked
@else
Active
@endif
|
@php
$registeredAt = $user->created_at
? $user->created_at->copy()->timezone('Asia/Kolkata')
: null;
@endphp
@if($registeredAt)
{{ $registeredAt->format('d-m-Y') }}
{{ $registeredAt->format('h:i A') }}
@else
N/A
@endif
|
{{-- =================================================
ACTION
================================================== --}}
@if ($isBlocked)
Unblock
@else
Block
@endif
|
@endforeach
{{-- =========================================================
BLOCK / UNBLOCK MODAL
========================================================== --}}
{{-- ICON --}}
{{-- TITLE --}}
Change Agent Status
{{-- DESCRIPTION --}}
Are you sure you want to change this agent's status?
{{-- FORM --}}
@endsection
@section('footer')
{{-- =========================================================
JQUERY
========================================================== --}}
{{-- =========================================================
DATATABLE CORE
========================================================== --}}
{{-- =========================================================
EXPORT DEPENDENCIES
========================================================== --}}
{{-- =========================================================
DATATABLE BUTTONS
========================================================== --}}
{{-- =========================================================
BLOCK / UNBLOCK
========================================================== --}}
{{-- =========================================================
PREVENT DOUBLE SUBMIT
========================================================== --}}
{{-- =========================================================
DATATABLE
========================================================== --}}
@endsection