<?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('token-dashboard')): ?>
    <section class=" bg-white mt-3 shadow-sm p-3 mb-3  rounded">

        <h2 class="text-center d-block ">Token Summary</h2>

        <div class=" row">


            <div class="col-xl-3 col-lg-3 col-md-4 col-sm-1">
                <div class="d-flex justify-content-between align-items-center token-container tokenLink ">
                    <div class="icon-holder"
                        style=" background-color: rgb(34 211 238 / 0.1);   --tw-text-opacity: 1;
  color: rgb(8 145 178 / var(--tw-text-opacity));">
                        <i class="fa-solid fa-plus " style="font-size:15px;"></i>
                    </div>
                    <div style="text-align: start !important">
                        <p class="text-bold my-1 h5 text-dark text-highlight">Today Created</p>
                        <p class="text-bold m-2 h4 text-start"><?php echo e($token['todayCreated']->sum('total') ?? 0); ?></p>
                    </div>

                    <i class="fa-solid fa-arrow-right text-dark rounded-lg p-1"
                        style="border: 1px solid rgba(53, 45, 45, 0.5);"></i>

                </div>
            </div>


            <div class="col-xl-3 col-lg-3 col-md-4 col-sm-1">
                <div class="d-flex  justify-content-between align-items-center token-container tokenLink ">
                    <div class="icon-holder"
                        style="background-color: rgb(248 113 113 / 0.1);  --tw-text-opacity: 1;
  color: rgb(220 38 38 / var(--tw-text-opacity));">
                        <i class="fa-brands fa-usps" style="font-size:15px;"></i>
                    </div>
                    <div style="text-align: start !important">
                        <p class="text-bold my-1 h5 text-dark text-highlight">Today Closed</p>
                        <p class="text-bold m-2 h4 text-start"><?php echo e($token['todayClosed']->sum('total') ?? 0); ?></p>
                    </div>

                    <i class="fa-solid fa-arrow-right text-dark rounded-lg p-1"
                        style="border: 1px solid rgba(53, 45, 45, 0.5);"></i>

                </div>
            </div>


            <div class="col-xl-3 col-lg-3 col-md-4 col-sm-1">

                <div class="d-flex  justify-content-between align-items-center token-container tokenLink ">
                    <div class="icon-holder"
                        style="background-color: rgb(167 139 250 / 0.1); --tw-text-opacity: 1;
  color: rgb(124 58 237 / var(--tw-text-opacity)); ">
                        <i class="fa-solid fa-hat-cowboy-side" style="font-size:15px;"></i>
                    </div>
                    <div style="text-align: start !important">
                        <p class="text-bold my-1 h5 text-dark text-highlight">Yesterday Created
                        </p>
                        <p class="text-bold m-2 h4 text-start"><?php echo e($token['yestardayCreated']->sum('total') ?? 0); ?>

                        </p>
                    </div>

                    <i class="fa-solid fa-arrow-right text-dark rounded-lg p-1"
                        style="border: 1px solid rgba(53, 45, 45, 0.5);"></i>

                </div>
            </div>



            <div class="col-xl-3 col-lg-3 col-md-4 col-sm-1">

                <div class="d-flex  justify-content-between align-items-center token-container tokenLink ">
                    <div class="icon-holder"
                        style="background-color: rgb(251 113 133 / 0.1); --tw-text-opacity: 1;
  color: rgb(225 29 72 / var(--tw-text-opacity));">
                        <i class="fa-solid fa-shop-lock" style="font-size:15px;"></i>
                    </div>
                    <div style="text-align: start !important">
                        <p class="text-bold my-1 h5 text-dark text-highlight">Yesterday Closed
                        </p>
                        <p class="text-bold m-2 h4 text-start"><?php echo e($token['yestardayClosed']->sum('total') ?? 0); ?>

                        </p>
                    </div>

                    <i class="fa-solid fa-arrow-right text-dark rounded-lg p-1"
                        style="border: 1px solid rgba(53, 45, 45, 0.5);"></i>

                </div>
            </div>



            <div class="col-xl-3 col-lg-3 col-md-4 col-sm-1">

                <div class="d-flex  justify-content-between align-items-center token-container tokenLink ">
                    <div class="icon-holder "
                        style="background-color: rgb(74 222 128 / 0.1);  --tw-text-opacity: 1;
  color: rgb(22 163 74 / var(--tw-text-opacity));">
                        <i class="fa-brands fa-openid " style="font-size:15px;"></i>
                    </div>
                    <div style="text-align: start !important">
                        <p class="text-bold my-1 h5 text-dark text-highlight">Monthly Created
                        </p>
                        <p class="text-bold m-2 h4 text-start"><?php echo e($token['monthlyCreated']->sum('total') ?? 0); ?>

                        </p>
                    </div>

                    <i class="fa-solid fa-arrow-right text-dark rounded-lg p-1"
                        style="border: 1px solid rgba(53, 45, 45, 0.5);"></i>

                </div>
            </div>


            <div class="col-xl-3 col-lg-3 col-md-4 col-sm-1">

                <div class="d-flex  justify-content-between align-items-center token-container tokenLink ">
                    <div class="icon-holder"
                        style="background-color: rgb(163 230 53 / 0.1); --tw-text-opacity: 1;
  color: rgb(101 163 13 / var(--tw-text-opacity));">
                        <i class="fa-brands fa-codepen" style="font-size:15px;"></i>
                    </div>
                    <div style="text-align: start !important">
                        <p class="text-bold my-1 h5 text-dark text-highlight">Monthly Closed
                        </p>
                        <p class="text-bold m-2 h4 text-start"><?php echo e($token['monthlyClosed']->sum('total') ?? 0); ?>

                        </p>
                    </div>

                    <i class="fa-solid fa-arrow-right text-dark rounded-lg p-1"
                        style="border: 1px solid rgba(53, 45, 45, 0.5);"></i>

                </div>
            </div>

            <div class="col-xl-3 col-lg-3 col-md-4 col-sm-1">


                <div class="d-flex  justify-content-between align-items-center token-container tokenLink ">
                    <div class="icon-holder"
                        style="background-color: rgb(56 189 248 / 0.1); --tw-text-opacity: 1;
  color: rgb(2 132 199 / var(--tw-text-opacity));">
                        <i class="fa-solid fa-pen-nib" style="font-size:15px;"></i>
                    </div>
                    <div style="text-align: start !important">
                        <p class="text-bold my-1 h5 text-dark text-highlight">Monthly Pending
                        </p>
                        <p class="text-bold m-2 h4 text-start"><?php echo e($token['monthlyPending']->sum('total') ?? 0); ?>

                        </p>
                    </div>

                    <i class="fa-solid fa-arrow-right text-dark rounded-lg p-1"
                        style="border: 1px solid rgba(53, 45, 45, 0.5);"></i>

                </div>
            </div>




            <div class="col-xl-3 col-lg-3 col-md-4 col-sm-1">
                <div class="d-flex  justify-content-between align-items-center token-container  tokenLink">
                    <div class="icon-holder"
                        style="background-color: rgb(251 146 60 / 0.1);  --tw-text-opacity: 1;
  color: rgb(234 88 12 / var(--tw-text-opacity));">
                        <i class="fa-brands fa-nfc-directional " style="font-size:15px;"></i>
                    </div>
                    <div style="text-align: start !important">
                        <p class="text-bold my-1 h5 text-dark text-highlight">Average
                            Time
                        </p>
                        <p class="text-bold m-2 h4 text-start"><?php echo e($token['avgCloseTime'][0]->avg_time ?? 0); ?>

                        </p>
                    </div>

                    <i class="fa-solid fa-arrow-right text-dark rounded-lg p-1"
                        style="border: 1px solid rgba(53, 45, 45, 0.5);"></i>

                </div>
            </div>

            <div class="col-xl-3 col-lg-3 col-md-4 col-sm-1" id="tokenSummary">
                <div class="d-flex  justify-content-between align-items-center token-container  tokenLink">
                    <div class="icon-holder"
                        style="background-color: rgb(232 121 249 / 0.1);  --tw-text-opacity: 1;
  color: rgb(192 38 211 / var(--tw-text-opacity));">
                        <i class="fa-solid fa-compact-disc" style="font-size:15px;"></i>
                    </div>
                    <div style="text-align: start !important">
                        <p class="text-bold my-1  text-dark text-highlight">Employee
                            Performance
                        </p>
                        <p class="text-bold m-2 h4 text-start">&nbsp;
                        </p>
                    </div>

                    <i class="fa-solid fa-arrow-right text-dark rounded-lg p-1 hover"
                        style="border: 1px solid rgba(53, 45, 45, 0.5); font-size:10px; "></i>

                </div>
            </div>

            <div class="col-xl-3 col-lg-3 col-md-4 col-sm-1">
                <div class="d-flex  justify-content-between align-items-center token-container  tokenLink">
                    <div class="icon-holder"
                        style="background-color: rgb(251 146 60 / 0.1);  --tw-text-opacity: 1;
  color: rgb(234 88 12 / var(--tw-text-opacity));">
                        <i class="fa-brands fa-nfc-directional " style="font-size:15px;"></i>
                    </div>
                    <div style="text-align: start !important">
                        <p class="text-bold my-1 h5 text-dark text-highlight">Today
                            Pending
                        </p>
                        <p class="text-bold m-2 h4 text-start"><?php echo e($token['todayPending']->sum('total') ?? 0); ?>

                        </p>
                    </div>

                    <i class="fa-solid fa-arrow-right text-dark rounded-lg p-1"
                        style="border: 1px solid rgba(53, 45, 45, 0.5);"></i>

                </div>
            </div>
            <div class="col-xl-3 col-lg-3 col-md-4 col-sm-1">
                <div class="d-flex  justify-content-between align-items-center token-container  tokenLink">
                    <div class="icon-holder"
                        style="background-color: rgb(251 146 60 / 0.1);  --tw-text-opacity: 1;
  color: rgb(234 88 12 / var(--tw-text-opacity));">
                        <i class="fa-brands fa-nfc-directional " style="font-size:15px;"></i>
                    </div>
                    <div style="text-align: start !important">
                        <p class="text-bold my-1 h5 text-dark text-highlight">
                            Yesterday Pending
                        </p>
                        <p class="text-bold m-2 h4 text-start"><?php echo e($token['yesterdayPending']->sum('total') ?? 0); ?>

                        </p>
                    </div>

                    <i class="fa-solid fa-arrow-right text-dark rounded-lg p-1"
                        style="border: 1px solid rgba(53, 45, 45, 0.5);"></i>

                </div>
            </div>
            <div class="col-xl-3 col-lg-3 col-md-4 col-sm-1">
                <div class="d-flex  justify-content-between align-items-center token-container  tokenLink">
                    <div class="icon-holder"
                        style="background-color: rgb(251 146 60 / 0.1);  --tw-text-opacity: 1;
  color: rgb(234 88 12 / var(--tw-text-opacity));">
                        <i class="fa-brands fa-nfc-directional " style="font-size:15px;"></i>
                    </div>
                    <div style="text-align: start !important">
                        <p class="text-bold my-1 h5 text-dark text-highlight">
                            Last Week Pending
                        </p>
                        <p class="text-bold m-2 h4 text-start"><?php echo e($token['lastWeekPending']->sum('total') ?? 0); ?>

                        </p>
                    </div>

                    <i class="fa-solid fa-arrow-right text-dark rounded-lg p-1"
                        style="border: 1px solid rgba(53, 45, 45, 0.5);"></i>

                </div>
            </div>



        </div>

    </section>

    <button class="btn" type="button" style="padding-left: 10px; padding-right:10px; background:#4338ca; color:white;">
        <a href="<?php echo e($createLink); ?>" style="color: white;">Add Token</a></button>

    <button class="btn " type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false"
        aria-controls="collapseExample" style="padding-left: 10px; padding-right:10px; background:#4338ca; color:white;">
        View Details Token Report
    </button>

    <div class="collapse" id="collapseExample">
        <div class="card card-body">

            <div class="row">
                <div class="col-sm-12">
                    <div class="row">

                        <div class="col-sm-4">
                            <div class="card ">

                                <div class="card-header">
                                    <p>Token Report of <?php echo e(date('Y-m-d', strtotime('yesterday'))); ?></p>
                                </div>

                                <div class="card-body">
                                    <div class="table-responsive">
                                        <table class="table table-hover table-responsive-lg " style="width:100%">
                                            <thead style="width:100%;">
                                                <tr class="bg-danger">

                                                    <th>Pop</th>
                                                    <th>Token</th>
                                                    <th>Closed</th>
                                                    <th>Pending</th>
                                                </tr>
                                            </thead>

                                            <tbody>
                                                <?php $__currentLoopData = $token['prevoiusDayToken']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $area): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <tr>
                                                        <td class="bg-light"><?php echo e($area['name'] ?? ''); ?></td>
                                                        <td class="bg-light"><?php echo e($area['lastdayTotalToken'] ?? ''); ?></td>
                                                        <td class="bg-light"><?php echo e($area['lastCToken'] ?? 0); ?></td>
                                                        <td class="bg-light"><?php echo e($area['lastpToken'] ?? 0); ?></td>
                                                    </tr>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                                            </tbody>
                                        </table>
                                    </div>
                                </div>

                            </div>
                        </div>

                        <div class="col-sm-4">
                            <div class="card">
                                <div class="card-header">
                                    <p>Token Report of <?php echo e(date('Y-m-d')); ?></p>
                                </div>
                                <div class="card-body">
                                    <div class="table-responsive">
                                        <table class="table table-hover table-responsive-lg " style="width:100%">
                                            <thead style="width:100%">
                                                <tr class="bg-danger">

                                                    <th>Pop</th>
                                                    <th>Token</th>
                                                    <th>Closed</th>
                                                    <th>Pending</th>
                                                </tr>
                                            </thead>

                                            <tbody>
                                                <?php $__currentLoopData = $token['areaName']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $area): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <tr>
                                                        <td class="bg-light"><?php echo e($area['name'] ?? ''); ?></td>
                                                        <td class="bg-light"><?php echo e($area['total'] ?? ''); ?></td>
                                                        <td class="bg-light"><?php echo e($area['ctotal'] ?? 0); ?></td>
                                                        <td class="bg-light"><?php echo e($area['ptotal'] ?? 0); ?></td>
                                                    </tr>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>


                        <div class="col-sm-4">
                            <div class="card ">
                                <div class="card-header">
                                    <p>Previous Pending Token</p>
                                </div>

                                <div class="card-body">
                                    <div class="table-responsive">

                                        <table class="table table-hover table-responsive-lg " style="width:100%">
                                            <thead style="width:100%">

                                                <tr class="bg-danger">

                                                    <th>Pop</th>
                                                    <th>Date</th>
                                                    <th>Open</th>
                                                </tr>
                                            </thead>

                                            <tbody>
                                                <?php $__currentLoopData = $token['prevoiusDayToken']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $prevoiusDayTokens): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if(isset($prevoiusDayTokens['lastpToken'])): ?>
                                                        <tr>
                                                            <td class="bg-light"><?php echo e($prevoiusDayTokens['name'] ?? ''); ?>

                                                            </td>
                                                            <?php
                                                                $test = $prevoiusDayTokens['lastpTokenDate'] ?? '';
                                                                $time = date('Y-m-d', strtotime($test));
                                                            ?>
                                                            <td class="bg-light"><?php echo e($time ?? ''); ?></td>
                                                            <td class="bg-light">
                                                                <?php echo e($prevoiusDayTokens['lastpToken'] ?? ''); ?>

                                                            </td>
                                                        </tr>
                                                    <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>




                        <div class="col-sm-4">
                            <div class="card">
                                <div class="card-header">
                                    <p>User Performance</p>
                                </div>

                                <div class="card-body">
                                    <div class="table-responsive">

                                        <table class="table table-hover table-responsive-lg" style="width:100%">
                                            <thead style="width:100%">
                                                <tr class="bg-danger">

                                                    <th>Name</th>
                                                    <th>Token Created</th>
                                                    <th>Token Closed</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php $__currentLoopData = $token['userWiseTokenReport']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $t): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    
                                                    <tr>
                                                        <td class="bg-light"><?php echo e($t['name'] ?? ''); ?></td>
                                                        <td class="bg-light">
                                                            <?php echo e($t['tokenCreate'] ?? 0); ?>

                                                        </td>
                                                        <td class="bg-light"><?php echo e($t['tokenClose'] ?? 0); ?></td>
                                                    </tr>
                                                    
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="col-sm-4">
                            <div class="card">
                                <div class="card-header">
                                    <p>Employee Performance</p>
                                </div>
                                <div class="card-body">
                                    <div class="table-responsive">

                                        <table class="table table-hover table-responsive-lg " style="width:100%">
                                            <thead style="width:100%">
                                                <tr class="bg-danger">

                                                    <th>Name</th>
                                                    <th>Token</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php $__currentLoopData = $token['employWiseTokenReport']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $t): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <tr>
                                                        <td class="bg-light"><?php echo e($t['name'] ?? ''); ?></td>
                                                        <td class="bg-light"><?php echo e($t['assignToken'] ?? 0); ?></td>
                                                    </tr>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>

<?php endif; ?>


<style>
    /* token generator box */
    .token-container {
        box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
        border-radius: 0.45rem;
        border: 0.25px solid rgb(223, 225, 226);


    }

    .text-highlight {
        letter-spacing: 0.025em;
        font-size: 16px;
        font-weight: 500;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        line-height: 1.75rem;
        text-transform: capitalize;

    }

    .icon-holder {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        padding: 18px;
        font-size: 16px;

    }

    .tokenLink {
        cursor: pointer;
        margin-bottom: 10px;
        padding: 10px;
    }
</style>
<?php /**PATH /var/www/html/fastbangla/radius-circle/resources/views/dashboard/token.blade.php ENDPATH**/ ?>