<?php $__env->startSection('title', config('app.name') . ' | Welcome Dashboard'); ?>

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

<!-- main content start-->
<div id="page-wrapper">

    <div class="main-page">

        <div class="widget-shadow">

            <?php echo $__env->make('partials.errors', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
            <?php echo $__env->make('partials.success', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

        </div>


        <!-- ========================================================= -->
        <!-- DASHBOARD STATISTICS -->
        <!-- ========================================================= -->

        <div class="row-one">

            <!-- TODAY DOCUMENTS -->
            <div class="col-md-4 widget">

                <div class="stats-left">

                    <h5>Today</h5>
                    <h4>Documents</h4>

                </div>

                <div class="stats-right">

                    <?php if(isset($tot_today)): ?>
                        <label><?php echo e($tot_today); ?></label>
                    <?php else: ?>
                        <label>0</label>
                    <?php endif; ?>

                </div>

                <div class="clearfix"></div>

            </div>


            <!-- TOTAL DOCUMENTS -->
            <div class="col-md-4 widget states-mdl">

                <div class="stats-left">

                    <h5>Total</h5>
                    <h4>Documents</h4>

                </div>

                <div class="stats-right">

                    <?php if(isset($totel_docs)): ?>
                        <label><?php echo e($totel_docs); ?></label>
                    <?php else: ?>
                        <label>0</label>
                    <?php endif; ?>

                </div>

                <div class="clearfix"></div>

            </div>


            <!-- TOTAL CUSTOMERS -->
            <div class="col-md-4 widget states-last">

                <div class="stats-left">

                    <h5>Total</h5>
                    <h4>Customers</h4>

                </div>

                <div class="stats-right">

                    <?php if(isset($tot_customer)): ?>
                        <label><?php echo e($tot_customer); ?></label>
                    <?php else: ?>
                        <label>0</label>
                    <?php endif; ?>

                </div>

                <div class="clearfix"></div>

            </div>

            <div class="clearfix"></div>

        </div>


        <!-- ========================================================= -->
        <!-- PREVIOUS MONTHS + LATEST DOCUMENTS -->
        <!-- ========================================================= -->

        <div class="row">


            <!-- ===================================================== -->
            <!-- PREVIOUS MONTHS -->
            <!-- ===================================================== -->

            <div class="col-md-4 stats-info widget">

                <div class="stats-title">

                    <h4 class="title">
                        Previous Months
                    </h4>

                </div>


                <div class="stats-body">

                    <ul class="list-unstyled">


                        <?php if(isset($get_documents_months) && $get_documents_months->count() > 0): ?>

                            <?php 
                                $month_count = 0;
                             ?>


                            <?php $__currentLoopData = $get_documents_months; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $month => $documents): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                <?php 
                                    $month_count++;

                                    $month_date = \Carbon\Carbon::createFromFormat(
                                        'Y-m',
                                        $month
                                    );
                                 ?>


                                <li
                                    <?php if($month_count == $get_documents_months->count()): ?>
                                        class="last"
                                    <?php endif; ?>
                                >

                                    <?php echo e($month_date->format('F Y')); ?>


                                    <span class="pull-right">

                                        <?php echo e($documents->count()); ?>


                                        <?php echo e($documents->count() == 1 ? 'Document' : 'Documents'); ?>


                                    </span>

                                </li>


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


                        <?php else: ?>

                            <li class="last">

                                No Previous Documents

                                <span class="pull-right">
                                    0 Documents
                                </span>

                            </li>

                        <?php endif; ?>


                    </ul>

                </div>

            </div>


            <!-- ===================================================== -->
            <!-- LATEST DOCUMENTS -->
            <!-- ===================================================== -->

            <div class="col-md-8 stats-info stats-last widget-shadow">


                <table class="table stats-table">


                    <thead>

                    <tr>

                        <th>Serial No</th>

                        <th>Customer Id</th>

                        <th>Customer Name</th>

                        <th>Doc-id</th>

                        <th>Status</th>

                    </tr>

                    </thead>


                    <tbody>


                    <?php if(isset($get_documents)): ?>


                        <?php $__empty_1 = true; $__currentLoopData = $get_documents; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $get_document): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>

                            <tr>

                                <th scope="row">
                                    <?php echo e($loop->iteration); ?>

                                </th>


                                <td>
                                    <?php echo e($get_document->customer_id); ?>

                                </td>


                                <td>
                                    <?php echo e($get_document->customer_name); ?>

                                </td>


                                <td>
                                    <?php echo e($get_document->document_id); ?>

                                </td>


                                <td>

                                    <a
                                        href="/document-view/<?php echo e($get_document->id); ?>"
                                        class="badge badge-success"
                                    >
                                        View
                                    </a>

                                </td>

                            </tr>


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


                            <tr>

                                <td colspan="5" class="text-center">

                                    No Record Found!

                                </td>

                            </tr>


                        <?php endif; ?>


                    <?php else: ?>


                        <tr>

                            <td colspan="5" class="text-center">

                                No Record Found!

                            </td>

                        </tr>


                    <?php endif; ?>


                    </tbody>

                </table>


            </div>


            <div class="clearfix"></div>

        </div>


        <div class="clearfix"></div>

    </div>

</div>

<!-- footer -->

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout.main', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>