

<?php $__env->startSection('title', 'Clients | EMI CREDITS'); ?>

<?php $__env->startSection('page-title', 'Clients'); ?>

<?php $__env->startSection(
    'page-description',
    'Manage registered clients and their application status'
); ?>

<?php $__env->startPush('styles'); ?>
<link rel="stylesheet" href="<?php echo e(asset('admin/css/clients.css')); ?>">
<?php $__env->stopPush(); ?>


<?php $__env->startSection('content'); ?>


<!-- =====================================================
     PAGE HEADING
====================================================== -->

<div class="page-heading">

    <div>
        <h2>
            Client Management
        </h2>

        <p>
            View and manage all registered EMI CREDITS clients.
        </p>
    </div>

    <a
        href="<?php echo e(route('admin.clients.create')); ?>"
        class="btn btn-primary"
    >
        + Add Client
    </a>

</div>




<!-- =====================================================
     SUMMARY
====================================================== -->

<div class="summary-grid">


    <div class="summary-card summary-blue">

        <div class="summary-label">
            Total Clients
        </div>

        <div class="summary-value">
            <?php echo e($totalClients ?? $clients->total()); ?>

        </div>

    </div>


    <div class="summary-card summary-green">

        <div class="summary-label">
            KYC Verified
        </div>

        <div class="summary-value">
            <?php echo e($verifiedKyc ?? 0); ?>

        </div>

    </div>


    <div class="summary-card summary-orange">

        <div class="summary-label">
            Pending KYC
        </div>

        <div class="summary-value">
            <?php echo e($pendingKyc ?? 0); ?>

        </div>

    </div>


    <div class="summary-card summary-red">

        <div class="summary-label">
            KYC Rejected
        </div>

        <div class="summary-value">
            <?php echo e($rejectedKyc ?? 0); ?>

        </div>

    </div>


</div>



<!-- =====================================================
     FILTER
====================================================== -->

<div class="filter-card">


    <div class="filter-title">

        Search Clients

    </div>


    <form
        method="GET"
        action="<?php echo e(route('admin.clients')); ?>"
        class="filter-form"
    >


        <div class="field">

            <label>
                Search
            </label>

            <input
                type="text"
                name="search"
                value="<?php echo e($search ?? ''); ?>"
                placeholder="Name, email or mobile..."
            >

        </div>


        <div class="field">

            <label>
                KYC Status
            </label>

            <select name="kyc_status">

                <option value="">
                    All Clients
                </option>

                <option
                    value="verified"
                    <?php echo e(($kycStatus ?? '') === 'verified'
                        ? 'selected'
                        : ''); ?>

                >
                    KYC Verified
                </option>

                <option
                    value="pending"
                    <?php echo e(($kycStatus ?? '') === 'pending'
                        ? 'selected'
                        : ''); ?>

                >
                    KYC Pending
                </option>

                <option
                    value="rejected"
                    <?php echo e(($kycStatus ?? '') === 'rejected'
                        ? 'selected'
                        : ''); ?>

                >
                    KYC Rejected
                </option>

            </select>

        </div>


        <button
            type="submit"
            class="search-btn"
        >

            🔎 Search

        </button>


        <a
            href="<?php echo e(route('admin.clients')); ?>"
            class="reset-btn"
        >

            Reset

        </a>


    </form>

</div>



<!-- =====================================================
     CLIENT TABLE
====================================================== -->

<div class="table-card">


    <div class="table-header">

        <h3>
            Registered Clients
        </h3>


        <span class="result-count">

            Showing

            <?php echo e($clients->firstItem() ?? 0); ?>


            -

            <?php echo e($clients->lastItem() ?? 0); ?>


            of

            <?php echo e($clients->total()); ?>


        </span>

    </div>



    <div class="table-wrap">


        <?php if($clients->count()): ?>


            <table>

                <thead>

                    <tr>

                        <th>
                            Client
                        </th>

                        <th>
                            Mobile
                        </th>

                        <th>
                            KYC
                        </th>

                        <th>
                            Application
                        </th>

                        <th>
                            Registered
                        </th>

                        <th>
                            Action
                        </th>

                    </tr>

                </thead>


                <tbody>


                    <?php $__currentLoopData = $clients; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $client): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>


                        <?php

                            $kyc =
                                $client->clientKyc;

                            $profile =
                                $client->clientProfile;

                        ?>


                        <tr>


                            <!-- CLIENT -->

                            <td>

                                <div class="client">


                                    <div class="client-avatar">

                                        <?php echo e(strtoupper(
                                                substr(
                                                    $client->name,
                                                    0,
                                                    1
                                                )
                                            )); ?>


                                    </div>


                                    <div>

                                        <span class="client-name">

                                            <?php echo e($client->name); ?>


                                        </span>


                                        <span class="client-email">

                                            <?php echo e($client->email); ?>


                                        </span>

                                    </div>


                                </div>

                            </td>



                            <!-- MOBILE -->

                            <td>
    <span class="client-mobile">
        <?php echo e($client->mobile ?? '-'); ?>

    </span>
</td>



                            <!-- KYC -->

                            <td>

                                <?php if(
                                    $kyc &&
                                    $kyc->status === 'verified'
                                ): ?>

                                    <span class="badge badge-green">

                                        <span class="dot"></span>

                                        Verified

                                    </span>


                                <?php elseif(
                                    $kyc &&
                                    $kyc->status === 'rejected'
                                ): ?>

                                    <span class="badge badge-red">

                                        <span class="dot"></span>

                                        Rejected

                                    </span>


                                <?php elseif($kyc): ?>

                                    <span class="badge badge-orange">

                                        <span class="dot"></span>

                                        Pending

                                    </span>


                                <?php else: ?>

                                    <span class="badge badge-gray">

                                        Not Submitted

                                    </span>

                                <?php endif; ?>

                            </td>



                            <!-- APPLICATION -->

                            <td>

                                <?php if($profile): ?>

                                    <span class="badge badge-green">

                                        <span class="dot"></span>

                                        Started

                                    </span>

                                <?php else: ?>

                                    <span class="badge badge-gray">

                                        Not Started

                                    </span>

                                <?php endif; ?>

                            </td>



                            <!-- REGISTERED -->

                            <td>
    <span class="client-registered">
        <?php echo e($client->created_at
                ? $client->created_at->format('d M Y')
                : '-'); ?>

    </span>
</td>



                            <!-- ACTION -->

                            <td>

                                <div class="actions">

                                    <a
                                        href="<?php echo e(route(
                                            'admin.clients.show',
                                            $client
                                        )); ?>"
                                        class="view-btn"
                                    >

                                        View

                                    </a>

                                </div>

                            </td>


                        </tr>


                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>


                </tbody>

            </table>


        <?php else: ?>


            <div class="empty">

                No clients found.

            </div>


        <?php endif; ?>


    </div>



    <!-- PAGINATION -->

    <?php if($clients->hasPages()): ?>

    <div class="pagination-area">

        <div class="pagination-info">
            Page <?php echo e($clients->currentPage()); ?>

            of <?php echo e($clients->lastPage()); ?>

        </div>

        <div class="pagination-links">

            <?php if($clients->onFirstPage()): ?>
                <span class="pagination-btn disabled">‹</span>
            <?php else: ?>
                <a href="<?php echo e($clients->previousPageUrl()); ?>" class="pagination-btn">‹</a>
            <?php endif; ?>

            <?php $__currentLoopData = $clients->getUrlRange(1, $clients->lastPage()); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $page => $url): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                <?php if($page == $clients->currentPage()): ?>
                    <span class="pagination-btn active">
                        <?php echo e($page); ?>

                    </span>
                <?php else: ?>
                    <a href="<?php echo e($url); ?>" class="pagination-btn">
                        <?php echo e($page); ?>

                    </a>
                <?php endif; ?>

            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

            <?php if($clients->hasMorePages()): ?>
                <a href="<?php echo e($clients->nextPageUrl()); ?>" class="pagination-btn">›</a>
            <?php else: ?>
                <span class="pagination-btn disabled">›</span>
            <?php endif; ?>

        </div>

    </div>

<?php endif; ?>


</div>


<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/eduintxshop/public_html/loan.eduintx.shop/resources/views/admin/clients/index.blade.php ENDPATH**/ ?>