<?php $__env->startSection('title', 'Admin Dashboard'); ?>


<?php $__env->startSection('internal-js'); ?>
    <script>
        $(document).ready(function () {
            $('#search-report').select2();
            $('#search-year').select2();
            $('#search-option').select2();
        });


        window.onload = function () {
            var chart = new CanvasJS.Chart("chartContainer", {
                animationEnabled: true,
                exportEnabled: true,
                theme: "light2",
                title: {
                    text: "<?php echo e($year); ?> Monthly Production Report"
                },
                axisX: {
                    valueFormatString: "MMM"
                },
                axisY: {
                    prefix: "<?php echo e($currency->abbr ?? ''); ?> ",
                    labelFormatter: addSymbols
                },
                toolTip: {
                    shared: true
                },
                legend: {
                    cursor: "pointer",
                    itemclick: toggleDataSeries
                },
                data: [
                    {
                        type: "column",
                        name: "Total Invoices",
                        showInLegend: true,
                        xValueFormatString: "MMMM YYYY",
                        yValueFormatString: "<?php echo e($currency->abbr ?? ''); ?> #,##0",
                        dataPoints: [
                            { x: new Date(<?php echo e($year); ?>, 0), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 1), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 2), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 3), y: 0},
                            { x: new Date(<?php echo e($year); ?>, 4), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 5), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 6), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 7), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 8), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 9), y:  0 },
                            { x: new Date(<?php echo e($year); ?>, 10), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 11), y: 0 }
                        ]
                    },
                    {
                        type: "line",
                        name: "Paid Invoices",
                        showInLegend: true,
                        yValueFormatString: "<?php echo e($currency->abbr ?? ''); ?> #,##0",
                        dataPoints: [
                            { x: new Date(<?php echo e($year); ?>, 0), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 1), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 2), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 3), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 4), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 5), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 6), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 7), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 8), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 9), y:  0},
                            { x: new Date(<?php echo e($year); ?>, 10), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 11), y: 0 }
                        ]
                    },
                    {
                        type: "area",
                        name: "Revenue",
                        markerBorderColor: "white",
                        markerBorderThickness: 2,
                        showInLegend: true,
                        yValueFormatString: "<?php echo e($currency->abbr ?? ''); ?> #,##0",
                        dataPoints: [
                            { x: new Date(<?php echo e($year); ?>, 0), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 1), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 2), y:0 },
                            { x: new Date(<?php echo e($year); ?>, 3), y: 0},
                            { x: new Date(<?php echo e($year); ?>, 4), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 5), y:0 },
                            { x: new Date(<?php echo e($year); ?>, 6), y: 0},
                            { x: new Date(<?php echo e($year); ?>, 7), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 8), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 9), y:  0},
                            { x: new Date(<?php echo e($year); ?>, 10), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 11), y: 0 }
                        ]
                    }]
            });

            var chartCommission = new CanvasJS.Chart("chartContainerCommission", {
                animationEnabled: true,
                exportEnabled: true,
                theme: "light2",
                title: {
                    text: "<?php echo e($year); ?> Monthly Commission Report"
                },
                axisX: {
                    valueFormatString: "MMM"
                },
                axisY: {
                    prefix: "<?php echo e($currency->abbr ?? ''); ?> ",
                    labelFormatter: addSymbols
                },
                toolTip: {
                    shared: true
                },
                legend: {
                    cursor: "pointer",
                    reversed: true,
                    itemclick: toggleDataSeries
                },
                data: [
                    {
                        type: "stackedColumn",
                        name: "Total Net Commission",
                        showInLegend: true,
                        xValueFormatString: "MMMM YYYY",
                        yValueFormatString: "<?php echo e($currency->abbr ?? ''); ?> #,##0",
                        dataPoints: [
                            { x: new Date(<?php echo e($year); ?>, 0), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 1), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 2), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 3), y: 0},
                            { x: new Date(<?php echo e($year); ?>, 4), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 5), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 6), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 7), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 8), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 9), y:  0},
                            { x: new Date(<?php echo e($year); ?>, 10), y: 0},
                            { x: new Date(<?php echo e($year); ?>, 11), y: 0 }
                        ]
                    },
                    {
                        type: "stackedColumn",
                        name: "W.Tax Commission",
                        showInLegend: true,
                        xValueFormatString: "MMMM YYYY",
                        yValueFormatString: "<?php echo e($currency->abbr ?? ''); ?> #,##0",
                        dataPoints: [
                            { x: new Date(<?php echo e($year); ?>, 0), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 1), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 2), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 3), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 4), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 5), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 6), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 7), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 8), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 9), y:  0 },
                            { x: new Date(<?php echo e($year); ?>, 10), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 11), y: 0 }
                        ]
                    },
                    {
                        type: "line",
                        name: "Received Commissions",
                        showInLegend: true,
                        yValueFormatString: "<?php echo e($currency->abbr ?? ''); ?> #,##0",
                        dataPoints: [
                            { x: new Date(<?php echo e($year); ?>, 0), y: 2000 },
                            { x: new Date(<?php echo e($year); ?>, 1), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 2), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 3), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 4), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 5), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 6), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 7), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 8), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 9), y: 0 },
                            { x: new Date(<?php echo e($year); ?>, 10), y: 2000 },
                            { x: new Date(<?php echo e($year); ?>, 11), y: 0 }
                        ]
                    }]
            });

            chart.render();
            chartCommission.render();

            function addSymbols(e) {
                var suffixes = ["", "K", "M", "B"];
                var order = Math.max(Math.floor(Math.log(e.value) / Math.log(1000)), 0);

                if(order > suffixes.length - 1)
                    order = suffixes.length - 1;

                var suffix = suffixes[order];
                return CanvasJS.formatNumber(e.value / Math.pow(1000, order)) + suffix;
            }

            function toggleDataSeries(e) {
                if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
                    e.dataSeries.visible = false;
                } else {
                    e.dataSeries.visible = true;
                }
                e.chart.render();
            }
        }
    </script>
<?php $__env->stopSection(); ?>


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

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


<?php $__env->startSection('headers'); ?>
    <?php echo $__env->make('headers.admin-header', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php $__env->stopSection(); ?>


<?php $__env->startSection('heading', 'Admin Dashboard'); ?>
<?php $__env->startSection('searches'); ?>
    <div style="float: right">
        <br>
        <?php echo Form::open(['route'=>['modules.admin.filter'], 'method'=>'POST', 'id'=>'filter-report-statement']); ?>

        <div class="guestDetails_input">
            <div class="guestDetails_input" style="text-align: center">
                Option: <select name="search-option" id="search-option" style="width: 80px">
                    
                    <option value="graphical">Graphical</option>
                    <option value="figures">Figures</option>
                </select>
            </div>
        </div>
        <div class="guestDetails_input">
            <div class="guestDetails_input" style="text-align: center">
                Type: <select name="search-report" id="search-report" style="width: 130px">
                   
                    <option value="premium">Sales Report</option>
                    <option value="commission">Income Report</option>
                </select>
            </div>
        </div>
        <div class="guestDetails_input">
            <div class="guestDetails_input" style="text-align: center">
                Year: <select name="search-year" id="search-year" style="width: 60px">
                    
                    <?php for($x=date('Y'); $x>=app('CompanySetup')->version_from; $x--): ?>
                        <option value="<?php echo e($x); ?>"><?php echo e($x); ?></option>
                    <?php endfor; ?>
                </select>
            </div>
        </div>
        <div class="guestDetails_input">
            <div class="guestDetails_input">
                <button type="submit" id="submit-search" style="width: auto; height: 22px; cursor: pointer" title="Search a Product"><i class="fa fa-search" aria-hidden="true"></i></button>
            </div>
        </div>
        <?php echo Form::close(); ?>

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


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

    <div id="chartContainerCommission" style="height: 400px; width: 95%;margin-left: auto; margin-right: auto"></div>
    <div id="chartContainer" style="height: 400px; width: 95%;margin-left: auto; margin-right: auto"></div>

    <?php if($search['type'] == 'commission'): ?>
        <script>
            document.getElementById('chartContainer').style.display="none";
        </script>
    <?php else: ?>
        <script>
            document.getElementById('chartContainerCommission').style.display="none";
        </script>
    <?php endif; ?>
    <div class="guestDetails_inputDivider"></div>

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




<?php $__env->startSection('modal_heading'); ?>
    <h1>Admin Dashboard</h1>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('modal_title'); ?>
    <h3><u>Dashboard Functionalities</u></h3>
    <b>
        <ol>
            <li>View Graphical Production Analysis</li>
            <li>View Branch Performance Report</li>
            <li>Get Graphical Client's Reports</li>
        </ol>
    </b>
<?php $__env->stopSection(); ?>






<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\edwulp_chemist\resources\views/modules/admin-dash.blade.php ENDPATH**/ ?>