

<?php $__env->startSection('title'); ?> Admin Dashboard <?php $__env->stopSection(); ?>
<?php $__env->startSection('styles'); ?>
<link rel="stylesheet" href="<?php echo e(asset('/css1/adminlte.css')); ?>">
<style>
    .btn-logout{
    background-color: rgb(109, 109, 109);
    border-style: none;
    color: #fff;
    }
    .btn-logout:hover {
        background-color:rgb(77, 76, 76);
        color: #fff;
    }
</style>
<?php $__env->stopSection(); ?>
<?php $__env->startPush('head-scripts'); ?>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.6.2/chart.min.js" integrity="sha512-tMabqarPtykgDtdtSqCL3uLVM0gS1ZkUAVhRFu1vSEFgvB73niFQWJuvviDyBGBH22Lcau4rHB5p2K2T0Xvr6Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

<script src="<?php echo e(asset('/js1/main.js')); ?>"></script>
<script src="<?php echo e(asset('/js1/adminlte.js')); ?>"></script>
<script src="<?php echo e(asset('/js1/demo.js')); ?>"></script>
<?php $__env->stopPush(); ?>
<?php $__env->startSection('content'); ?>
<div class="single-product-tab-area">
    <!-- Single pro tab review Start-->
    <div class="single-pro-review-area">
        <div class="container-fluid">
            <div class="row">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                    <div class="review-tab-pro-inner">
                        <div class="error_msg">
                            <p style="text-align: center; color: red;" id="errMsg"></p>
                        </div>

                        <!-- Main content -->
                        <section class="content">
                            <div class="container-fluid">
                                <div class="row">

                                    <div class="col-md-8">
                                        <!-- DONUT CHART -->
                                        <div class="card ">
                                            <div class="card-header card-honey">
                                                <h3 class="card-title">Order Status</h3>
                                                <div class="card-tools">
                                                    <button type="button" class="btn btn-tool" data-card-widget="collapse">
                                                        <i class="fas fa-minus"></i>
                                                    </button>
                                                    <button type="button" class="btn btn-tool" data-card-widget="remove">
                                                        <i class="fas fa-times"></i>
                                                    </button>
                                                </div>
                                            </div>
                                            <div class="card-body">
                                                <div class="row">
                                                    <div class="col-6">
                                                        <canvas id="donutChart" style="min-height: 250px; height: 250px; max-height: 250px; max-width: 100%;"></canvas>
                                                    </div>
                                                    <div class="col-6">
                                                        <table class="status-table table table-striped table-bordered">
                                                            <thead>
                                                                <tr>
                                                                </tr>
                                                            </thead>
                                                            <tbody>
                                                                <tr>
                                                                    <td>Delivery</td>
                                                                    <td><?php echo e($orderStatuses->delivery); ?></td>
                                                                </tr>
                                                                <tr>
                                                                    <td>In Transit</td>
                                                                    <td><?php echo e($orderStatuses->in_transit); ?></td>
                                                                </tr>
                                                                <tr>
                                                                    <td>Pickup</td>
                                                                    <td><?php echo e($orderStatuses->pickup); ?></td>
                                                                </tr>
                                                                <tr>
                                                                    <td>Staged</td>
                                                                    <td><?php echo e($orderStatuses->staged); ?></td>
                                                                </tr>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>

                                            </div>
                                            <!-- /.card-body -->
                                        </div>
                                        <!-- /.card -->
                                    </div>

                                    <div class="col-md-12">
                                        <!-- AREA CHART: Task Completion-Days -->
                                        <div class="card">
                                            <div class="card-header card-honey">
                                                <h3 class="card-title">Task Completion-Days</h3>

                                                <div class="card-tools">
                                                    <button type="button" class="btn btn-tool" data-card-widget="collapse">
                                                        <i class="fas fa-minus"></i>
                                                    </button>
                                                    <button type="button" class="btn btn-tool" data-card-widget="remove">
                                                        <i class="fas fa-times"></i>
                                                    </button>
                                                </div>
                                            </div>

                                            <div class="card-body">
                                                <div class="row">
                                                    <div class="col-lg-7 col-md-12 col-sm-12">
                                                        <div class="chart">
                                                            <canvas id="areaChart" style="min-height: 250px; height: 350px; max-height: 350px; max-width: 100%;"></canvas>
                                                        </div>
                                                    </div>
                                                    <div class="col-lg-5 col-md-12 col-sm-12">
                                                        <table id="task-days-table" class="task-table table table-striped table-bordered">
                                                        <thead>
                                                            <tr>
                                                                <td>Status</td>
                                                                <?php $__currentLoopData = $dates; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $date): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                                    <td><?php echo e($date->format('d M')); ?></td>
                                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                            </tr>
                                                        </thead>
                                                            <tbody>
                                                                <?php $__currentLoopData = $lineData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                                    <tr>
                                                                        <td>
                                                                            <?php 
                                                                                if($data->order_status_name === "Unassigned") {
                                                                                    print "Ordrered";
                                                                                } else if($data->order_status_name === "Assigned") {
                                                                                    print "Ready";
                                                                                } else if($data->order_status_name === "Picked Up") {
                                                                                    print "Pickup";
                                                                                } else {
                                                                                    print $data->order_status_name;
                                                                                }
                                                                            ?>
                                                                        </td>
                                                                        <td><?php echo e($data->day1); ?></td>
                                                                        <td><?php echo e($data->day2); ?></td>
                                                                        <td><?php echo e($data->day3); ?></td>
                                                                        <td><?php echo e($data->day4); ?></td>
                                                                        <td><?php echo e($data->day5); ?></td>
                                                                        <td><?php echo e($data->day6); ?></td>
                                                                        <td><?php echo e($data->day7); ?></td>
                                                                    </tr>
                                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                            </div>


                                        </div>
                                        <!-- /.card -->

                                    </div>
                                    <!-- /.col (LEFT) -->
                                    <div class="col-md-12">

                                        <div class="card">
                                            <div class="card-header card-honey">
                                                <h3 class="card-title">Task Completion-Agents</h3>

                                                <div class="card-tools">
                                                    <button type="button" class="btn btn-tool" data-card-widget="collapse">
                                                        <i class="fas fa-minus"></i>
                                                    </button>
                                                    <button type="button" class="btn btn-tool" data-card-widget="remove">
                                                        <i class="fas fa-times"></i>
                                                    </button>
                                                </div>
                                            </div>
                                            <div class="card-body">
                                                <div class="row">
                                                    <div class="col-lg-7 col-md-12 col-sm-12">
                                                        <canvas id="barChart" style="min-height: 250px; height: 250px; max-height: 250px; max-width: 100%;"></canvas>
                                                    </div>
                                                    <div class="col-lg-5 col-md-12 col-sm-12">
                                                        <table id="task-agent-table" class="task-table table table-striped table-bordered">
                                                            <thead>
                                                                <tr>
                                                                    <td>ID</td>
                                                                    <td>Name</td>
                                                                    <td>Accepted</td>
                                                                    <td>Delivered</td>
                                                                    <td>In Process</td>
                                                                </tr>
                                                            </thead>
                                                            <tbody>
                                                                <tr>
                                                                    <td>1</td>
                                                                    <td>Dona</td>
                                                                    <td>1</td>
                                                                    <td>1</td>
                                                                    <td>0</td>
                                                                </tr>
                                                                <tr>
                                                                    <td>2</td>
                                                                    <td>Ayaka</td>
                                                                    <td>0</td>
                                                                    <td>2</td>
                                                                    <td>4</td>
                                                                </tr>
                                                                <tr>
                                                                    <td>3</td>
                                                                    <td>Adi</td>
                                                                    <td>1</td>
                                                                    <td>2</td>
                                                                    <td>3</td>
                                                                </tr>
                                                                <tr>
                                                                    <td>4</td>
                                                                    <td>Andrew</td>
                                                                    <td>3</td>
                                                                    <td>2</td>
                                                                    <td>1</td>
                                                                </tr>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                            </div>
                                            <!-- /.card-body -->
                                        </div>
                                        <!-- /.card -->

                                        <!-- STACKED BAR CHART -->
                                        <div class="card">
                                            <div class="card-header card-honey">
                                                <h3 class="card-title">Agent Reports</h3>

                                                <div class="card-tools">
                                                    <button type="button" class="btn btn-tool" data-card-widget="collapse">
                                                        <i class="fas fa-minus"></i>
                                                    </button>
                                                    <button type="button" class="btn btn-tool" data-card-widget="remove">
                                                        <i class="fas fa-times"></i>
                                                    </button>
                                                </div>
                                            </div>
                                            <div class="card-body">
                                                <div class="chart">
                                                    <!-- <canvas id="stackedBarChart" style="min-height: 250px; height: 250px; max-height: 250px; max-width: 100%;"></canvas> -->
                                                    <!-- <div class="col-4"> -->
                                                    <table id="agent-report-table" class="table table-striped table-bordered">
                                                        <thead>
                                                            <tr>
                                                                <th>No.</th>
                                                                <th>Name</th>
                                                                <th>Mobile</th>
                                                                <th>Total KM Travelled</th>
                                                                <th>Total KM Travelled for Delivery</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr id="1">
                                                                <td>1</td>
                                                                <td>Dona</td>
                                                                <td>0000000000</td>
                                                                <td>3.2</td>
                                                                <td>0.0</td>
                                                            </tr>
                                                            <tr id="2">
                                                                <td>2</td>
                                                                <td>Ayaka</td>
                                                                <td>0000000000</td>
                                                                <td>0</td>
                                                                <td>0.0</td>
                                                            </tr>
                                                            <tr id="3">
                                                                <td>3</td>
                                                                <td>Adi</td>
                                                                <td>0000000000</td>
                                                                <td>6.9</td>
                                                                <td>4.0</td>
                                                            </tr>
                                                            <tr id="4">
                                                                <td>4</td>
                                                                <td>Andrew</td>
                                                                <td>0000000000</td>
                                                                <td>0</td>
                                                                <td>0.0</td>
                                                            </tr>
                                                            <tr id="5">
                                                                <td>5</td>
                                                                <td>Saki</td>
                                                                <td>0000000000</td>
                                                                <td>0</td>
                                                                <td>0.0</td>
                                                            </tr>
                                                            <tr id="6">
                                                                <td>6</td>
                                                                <td>Diana</td>
                                                                <td>0000000000</td>
                                                                <td>0</td>
                                                                <td>0.0</td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <!-- </div> -->
                                                </div>
                                            </div>
                                        </div>

                                        <!-- /.card -->
                                    </div>
                                    <!-- /.col (RIGHT) -->
                                </div>
                                <!-- /.row -->
                            </div><!-- /.container-fluid -->
                        </section>
                        <!-- /.content -->


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

<?php $__env->startPush('scripts'); ?>
<script>
    //     $(document).ready(function() {
    //         $('#task-days-table').DataTable();
    //     } );

    //     $(document).ready(function() {
    //         $('#task-agent-table').DataTable();
    //     } );

    //     $(document).ready(function() {
    //         $('#agent-report-table').DataTable();
    //     } );
    // 
</script>

<script>
    $(function() {
        /* ChartJS
         * -------
         * Here we will create a few charts using ChartJS
         */

        //--------------
        //- AREA CHART -
        //--------------

        // Get context with jQuery - using jQuery's .get() method.
        var areaChartCanvas = $('#areaChart').get(0).getContext('2d')

        var areaChartData = <?php echo $lineChart; ?>


        var areaChartOptions = {
            maintainAspectRatio: false,
            responsive: true,
            legend: {
                display: false
            },
            scales: {
                xAxes: [{
                    gridLines: {
                        display: false,
                    }
                }],
                yAxes: [{
                    gridLines: {
                        display: false,
                    }
                }]
            }
        }

        // This will get the first returned node in the jQuery collection.
        new Chart(areaChartCanvas, {
            type: 'line',
            data: areaChartData,
            options: areaChartOptions
        })


        //-------------
        // Get context with jQuery - using jQuery's .get() method.
        var donutChartCanvas = $('#donutChart').get(0).getContext('2d')
        var donutData = {
            labels: [
                'Delivery',
                'In Transit',
                'Pickup',
                'Stage',
            ],
            datasets: [{
                data: ["<?php echo e($orderStatuses->delivery); ?>", "<?php echo e($orderStatuses->in_transit); ?>", "<?php echo e($orderStatuses->pickup); ?>", "<?php echo e($orderStatuses->staged); ?>"],
                backgroundColor: ['#2ec4b6', '#ffbf69', '#cbf3f0', '#126782'],
            }]
        }
        var donutOptions = {
            maintainAspectRatio: false,
            responsive: true,
        }
        //Create pie or douhnut chart
        // You can switch between pie and douhnut using the method below.
        new Chart(donutChartCanvas, {
            type: 'doughnut',
            data: donutData,
            options: donutOptions
        })

        //-------------
        //- PIE CHART -
        //-------------
        // Get context with jQuery - using jQuery's .get() method.
        var pieChartCanvas = $('#pieChart').get(0).getContext('2d')
        // var pieData        = donutData;
        var pieData = {
            labels: [
                'Busy',
                'Free',
            ],
            datasets: [{
                data: [700, 500],
                backgroundColor: ['#ffbf69', '#2ec4b6'],
            }]
        }
        var pieOptions = {
            maintainAspectRatio: false,
            responsive: true,
        }
        //Create pie or douhnut chart
        // You can switch between pie and douhnut using the method below.
        new Chart(pieChartCanvas, {
            type: 'doughnut',
            data: pieData,
            options: pieOptions
        })

        //-------------
        //- BAR CHART -
        //-------------
        var barChartCanvas = $('#barChart').get(0).getContext('2d')
        // var barChartData = $.extend(true, {}, areaChartData)


        var barChartData = {
            labels: ['Dona', 'Ayaka', 'Adi', 'Andrew', 'Saki', 'Diana', ],
            datasets: [{
                    label: 'Delivered',
                    backgroundColor: '#2ec4b6',
                    borderColor: '#2ec4b6',
                    pointRadius: false,
                    pointColor: '#2ec4b6',
                    pointStrokeColor: '#2ec4b6',
                    pointHighlightFill: '#fff',
                    pointHighlightStroke: '#2ec4b6',
                    data: [28, 48, 40, 19, 86, 27, 90]
                },
                {
                    label: 'In process',
                    backgroundColor: '#ffbf69',
                    borderColor: '#ffbf69',
                    pointRadius: false,
                    pointColor: '#ffbf69',
                    pointStrokeColor: '#ffbf69',
                    pointHighlightFill: '#fff',
                    pointHighlightStroke: '#ffbf69',
                    data: [40, 29, 68, 99, 56, 55, 33]
                },
                {
                    label: 'Accepted',
                    backgroundColor: '#cbf3f0',
                    borderColor: '#cbf3f0',
                    pointRadius: false,
                    pointColor: '#cbf3f0',
                    pointStrokeColor: '#cbf3f0',
                    pointHighlightFill: '#fff',
                    pointHighlightStroke: '#cbf3f0',
                    data: [65, 59, 80, 81, 56, 55, 40]
                },
            ]
        }

        var barChartOptions = {
            responsive: true,
            maintainAspectRatio: false,
            datasetFill: false
        }

        new Chart(barChartCanvas, {
            type: 'bar',
            data: barChartData,
            options: barChartOptions
        })

        //---------------------
        //- STACKED BAR CHART -
        //---------------------

        //     data: stackedBarChartData,
        //     options: stackedBarChartOptions
        //     })
    })
</script>
<?php $__env->stopPush(); ?>

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