<?php $__env->startSection('title', __('dashboard.dashboard')); ?>

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

    <div class="page-bar">
        <div class="page-title-breadcrumb">

        </div>
    </div>

    <div class="row">
        <div class="col-lg-3 col-md-6 col-sm-6 col-12">
            <div class="analysis-box m-b-0 bg-b-purple">
                <h3 class="text-white box-title"><a href="<?php echo e(route('admin.branch.index')); ?>">Branch</a> <span
                        class="pull-right"><i class="fa fa-caret-up"></i> <?php echo e($branches->count()); ?></span></h3>
                
            </div>
        </div>
        <div class="col-lg-3 col-md-6 col-sm-6 col-12">
            <div class="analysis-box m-b-0 bg-b-danger">
                <h3 class="text-white box-title"><a href="<?php echo e(route('admin.user.index')); ?>">Employee</a> <span
                        class="pull-right"><i class="fa fa-caret-up"></i> <?php echo e($users->count()); ?></span></h3>
                
            </div>
        </div>
        <div class="col-lg-3 col-md-6 col-sm-6 col-12">
            <div class="analysis-box m-b-0 bg-b-cyan">
                <h3 class="text-white box-title"><a href="<?php echo e(route('admin.farmer.index')); ?>">Farmer</a> <span
                        class="pull-right"><i class="fa fa-caret-up"></i> <?php echo e(DB::table('farmers')->count()); ?></span></h3>
                
            </div>
        </div>
        <div class="col-lg-3 col-md-6 col-sm-6 col-12">
            <div class="analysis-box m-b-0 bg-b-blue">
                <h3 class="text-white box-title"><a href="<?php echo e(route('admin.product.index')); ?>">Product</a><span
                        class="pull-right"><i class="fa fa-caret-up"></i> <?php echo e(DB::table('products')->count()); ?></span></h3>
                
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="card-box">
                <div class="card-head">
                    <header>Stock Values</header>
                </div>
                <div class="card-body ">
                    <div class="state-overview">
                        <div class="row">
                            <div class="col-xl-3 col-md-6 col-12">
                                <div class="info-box bg-blue">
                                    <span class="info-box-icon push-bottom"><i class="material-icons">group</i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Chick Amount</span>
                                        <span class="info-box-number"><?php echo e(App\Helpers\Helpers::totalChicksQuantity()); ?>

                                            Pcs</span>
                                        <div class="progress">
                                            <div class="progress-bar" style="width: 45%"></div>
                                        </div>
                                        <span class="progress-description">
                                            <?php if($chicks): ?>
                                                <?php echo e(optional(optional($chicks)->products)->count() ?? 0); ?> Items
                                            <?php endif; ?>
                                        </span>
                                    </div>
                                    <!-- /.info-box-content -->
                                </div>
                                <!-- /.info-box -->
                            </div>
                            <!-- /.col -->
                            <div class="col-xl-3 col-md-6 col-12">
                                <div class="info-box bg-orange">
                                    <span class="info-box-icon push-bottom"><i class="material-icons">person</i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Feed Amount</span>
                                        <span class="info-box-number">
                                            <?php echo e(App\Helpers\Helpers::totalFeedQuantity()); ?>Pcs</span>
                                        <div class="progress">
                                            <div class="progress-bar" style="width: 40%"></div>
                                        </div>
                                        <span class="progress-description">
                                            <?php echo e(optional(optional($feeds)->products)->count() ?? 0); ?> Items
                                        </span>
                                    </div>
                                    <!-- /.info-box-content -->
                                </div>
                                <!-- /.info-box -->
                            </div>
                            <!-- /.col -->
                            <div class="col-xl-3 col-md-6 col-12">
                                <div class="info-box bg-purple">
                                    <span class="info-box-icon push-bottom"><i class="material-icons">content_cut</i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Medicine Amount</span>
                                        <span class="info-box-number"><?php echo e(App\Helpers\Helpers::totalMedicineQuantity()); ?>

                                            Pcs</span>
                                        <div class="progress">
                                            <div class="progress-bar" style="width: 85%"></div>
                                        </div>
                                        <span class="progress-description">
                                            <?php echo e(optional(optional($medicines)->products)->count() ?? 0); ?> Items
                                        </span>
                                    </div>
                                    <!-- /.info-box-content -->
                                </div>
                                <!-- /.info-box -->
                            </div>
                            <!-- /.col -->
                            <div class="col-xl-3 col-md-6 col-12">
                                <div class="info-box bg-success">
                                    <span class="info-box-icon push-bottom"><i
                                            class="material-icons">monetization_on</i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Total Stock</span>
                                        <span class="info-box-number">
                                            <?php echo e(App\Helpers\Helpers::totalStock()); ?>Pcs</span><span></span>
                                        <div class="progress">
                                            <div class="progress-bar" style="width: 50%"></div>
                                        </div>
                                        <span class="progress-description">
                                            <?php echo e(DB::table('products')->count()); ?> Items
                                        </span>
                                    </div>
                                    <!-- /.info-box-content -->
                                </div>
                                <!-- /.info-box -->
                            </div>
                            <!-- /.col -->
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    
    <div class="row">
        <div class="col-sm-12">
            <div class="card-box">
                <div class="card-head">
                    <header>Active Batch Stock</header>
                </div>
                <div class="card-body ">
                    <div class="state-overview">
                        <div class="row">
                            <div class="col-xl-3 col-md-6 col-12">
                                <div class="info-box bg-blue">
                                    <span class="info-box-icon push-bottom"><i class="material-icons">group</i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Active Batch Chick Quantity</span>
                                        <span class="info-box-number"><?php echo e(App\Helpers\Helpers::farmersActiveBatchCickQuantity()); ?>

                                            Pcs</span>
                                        <div class="progress">
                                            <div class="progress-bar" style="width: 45%"></div>
                                        </div>
                                        <span class="progress-description">
                                            <?php if($activeBatchs): ?>
                                                <?php echo e($activeBatchs ?? 0); ?> Active Batchs
                                            <?php endif; ?>
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-md-6 col-12">
                                <div class="info-box bg-info">
                                    <span class="info-box-icon push-bottom"><i class="material-icons">monetization_on</i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Total Chick Amount</span>
                                        <span class="info-box-number"><?php echo e(number_format(App\Helpers\Helpers::farmersActiveBatchCickAmount(), 2)); ?>

                                            Tk</span>
                                        <div class="progress">
                                            <div class="progress-bar" style="width: 45%"></div>
                                        </div>
                                        <span class="progress-description">Chick Sell Amount</span>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-md-6 col-12">
                                <div class="info-box bg-info">
                                    <span class="info-box-icon push-bottom"><i class="material-icons">monetization_on</i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Total Feed</span>
                                        <span class="info-box-number"><?php echo e(number_format(App\Helpers\Helpers::totalActiveBatchFeed()->total_selling, 2)); ?>

                                            Tk</span>
                                        <div class="progress">
                                            <div class="progress-bar" style="width: 45%"></div>
                                        </div>
                                        <span class="progress-description">Chick Sell Amount</span>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-md-6 col-12">
                                <div class="info-box bg-warning">
                                    <span class="info-box-icon push-bottom"><i class="material-icons">monetization_on</i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Total Feed Qty.</span>
                                        <span class="info-box-number"><?php echo e(number_format(App\Helpers\Helpers::totalActiveBatchFeed()->quantity, 2)); ?>

                                            Bag</span>
                                        <div class="progress">
                                            <div class="progress-bar" style="width: 45%"></div>
                                        </div>
                                        <span class="progress-description">Chick Sell Qty</span>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-md-6 col-12">
                                <div class="info-box bg-warning">
                                    <span class="info-box-icon push-bottom"><i class="material-icons">monetization_on</i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Total Medicine</span>
                                        <span class="info-box-number"><?php echo e(number_format(App\Helpers\Helpers::totalActiveBatchMedicine()->total_selling, 2)); ?>

                                            Tk</span>
                                        <div class="progress">
                                            <div class="progress-bar" style="width: 45%"></div>
                                        </div>
                                        <span class="progress-description">Chick Sell Qty</span>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-md-6 col-12">
                                <div class="info-box bg-warning">
                                    <span class="info-box-icon push-bottom"><i class="material-icons">monetization_on</i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Total Medicine Qty.</span>
                                        <span class="info-box-number"><?php echo e(number_format(App\Helpers\Helpers::totalActiveBatchMedicine()->quantity, 2)); ?>

                                            </span>
                                        <div class="progress">
                                            <div class="progress-bar" style="width: 45%"></div>
                                        </div>
                                        <span class="progress-description">Chick Sell Qty</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-sm-12">
            <div class="card-box">
                <div class="card-head">
                    <header>Payments & Collection</header>
                </div>
                <div class="card-body ">
                    <div class="state-overview">
                        <div class="row">
                            <div class="col-xl-3 col-md-6 col-12">
                                <div class="info-box bg-orange">
                                    <span class="info-box-icon push-bottom"><i
                                            class="material-icons">monetization_on</i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Payment</span>
                                        <span class="info-box-number"><?php echo e(\App\Helpers\Payments::totalDailyPayment() ?? 0); ?>

                                            Tk</span>
                                        <div class="progress">
                                            <div class="progress-bar" style="width: 45%"></div>
                                        </div>
                                        <span class="progress-description">
                                            Today
                                        </span>
                                    </div>
                                    <!-- /.info-box-content -->
                                </div>
                                <!-- /.info-box -->
                            </div>
                            <!-- /.col -->
                            <div class="col-xl-3 col-md-6 col-12">
                                <div class="info-box bg-b-black">
                                    <span class="info-box-icon push-bottom"><i
                                            class="material-icons">monetization_on</i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Payment</span>
                                        <span class="info-box-number"><?php echo e(\App\Helpers\Payments::totalPayment() ?? 0); ?>

                                            Tk</span>
                                        <div class="progress">
                                            <div class="progress-bar" style="width: 40%"></div>
                                        </div>
                                        <span class="progress-description">
                                            Total
                                        </span>
                                    </div>
                                    <!-- /.info-box-content -->
                                </div>
                                <!-- /.info-box -->
                            </div>
                            <!-- /.col -->
                            <div class="col-xl-3 col-md-6 col-12">
                                <div class="info-box bg-orange">
                                    <span class="info-box-icon push-bottom"><i
                                            class="material-icons">monetization_on</i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Collection</span>
                                        <span
                                            class="info-box-number"><?php echo e(\App\Helpers\Collections::dailyTotalCollection() ?? 0); ?>

                                            Tk</span>
                                        <div class="progress">
                                            <div class="progress-bar" style="width: 100%"></div>
                                        </div>
                                        <span class="progress-description">
                                            Today
                                        </span>

                                    </div>
                                    <!-- /.info-box-content -->
                                </div>
                                <!-- /.info-box -->
                            </div>
                            <!-- /.col -->
                            <div class="col-xl-3 col-md-6 col-12">
                                <div class="info-box bg-b-black">
                                    <span class="info-box-icon push-bottom"><i
                                            class="material-icons">monetization_on</i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Collection</span>
                                        <span
                                            class="info-box-number"><?php echo e(\App\Helpers\Collections::totalCollection() ?? 0); ?>

                                            Tk</span><span></span>
                                        <div class="progress">
                                            <div class="progress-bar" style="width: 100%"></div>
                                        </div>
                                        <span class="progress-description">
                                            Total
                                        </span>

                                    </div>
                                    <!-- /.info-box-content -->
                                </div>
                                <!-- /.info-box -->
                            </div>
                            <!-- /.col -->
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <div class="row">
        <div class="col-md-4">
            <div class="card card-box">
                <div class="card-head">
                    <header>Activity Logs</header>
                </div>
                <div class="card-body no-padding height-9">
                    <div class="row">
                        <ul class="docListWindow small-slimscroll-style">
                            <?php $__currentLoopData = $audits; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $audit): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php
                                    $sparateAuditableType = explode('App\Models\\', $audit->auditable_type);
                                    if ($audit->event == 'created') {
                                        $eventTextColor = 'text-success';
                                    } elseif ($audit->event == 'deleted') {
                                        $eventTextColor = 'text-danger';
                                    } elseif ($audit->event == 'updated') {
                                        $eventTextColor = 'text-info';
                                    } else {
                                        $eventTextColor = 'text-primary';
                                    }
                                    
                                ?>
                                <li>
                                    <b><?php echo e(optional($audit->user)->name ?? 'N/A'); ?> <span
                                            class="<?php echo e($eventTextColor); ?>"><?php echo e($audit->event); ?></span></b>
                                    <?php echo e($sparateAuditableType[1]); ?>

                                    <code class="pull-right" style="font-size: 12px">
                                        <?php echo e(str_replace(['minutes', 'minute', 'second', 'seconds'], ['mins', 'min', 'sec', 'secs'], $audit->created_at->diffForHumans())); ?></code>

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

                        <div class="full-width text-center p-t-10">
                            <?php echo e($audits->links()); ?>

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

        <div class="col-lg-4 col-md-12 col-sm-12 col-12">
            <div class="card card-box">
                <div class="card-head">
                    <header>Employee List</header>
                </div>
                <div class="card-body ">
                    <div class="row">
                        <ul class="docListWindow small-slimscroll-style">
                            <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if(!Auth::user()->hasRole('superadmin')): ?>
                                    <?php if($loop->first): ?>
                                        <?php continue; ?>
                                    <?php endif; ?>
                                <?php endif; ?>
                                <li>
                                    <div class="prog-avatar">
                                        <img src="<?php echo e(asset('admin/assets/img/user-avator.png')); ?>" alt=""
                                            width="40" height="40">
                                    </div>
                                    <div class="details">
                                        <div class="title">
                                            <a href="#"><?php echo e($user->name); ?></a> -(<?php $__currentLoopData = $user->roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $userRoles): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <?php echo e($userRoles->name . ')'); ?>

                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </div>
                                        <div>
                                            <span class="clsAvailable">
                                                <?php echo e($user->branch->name ?? ''); ?>

                                            </span>
                                        </div>
                                    </div>
                                </li>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </ul>
                        <div class="full-width text-center p-t-10">
                            <a href="<?php echo e(route('admin.user.index')); ?>"
                                class="btn purple btn-outline btn-circle margin-0">View All</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>



<?php $__env->stopSection(); ?>

<?php echo $__env->make('template.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/forazitradersbd/public_html/resources/views/admin/dashboard/admin.blade.php ENDPATH**/ ?>