<?php $__env->startSection('title', __('report.monthly', ['year_month' => $months[$month].' '.$year])); ?>

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

<?php echo e(Form::open(['method' => 'get', 'class' => 'form-inline well well-sm'])); ?>

<?php echo e(Form::label('month', __('report.view_monthly_label'), ['class' => 'control-label'])); ?>

<?php echo e(Form::select('month', $months, $month, ['class' => 'form-control'])); ?>

<?php echo e(Form::select('year', $years, $year, ['class' => 'form-control'])); ?>

<?php echo e(Form::submit(__('report.view_report'), ['class' => 'btn btn-info btn-sm'])); ?>

<?php echo e(link_to_route('reports.sales.monthly', __('report.this_month'), [], ['class' => 'btn btn-default btn-sm'])); ?>

<?php echo e(link_to_route('reports.sales.yearly', __('report.view_yearly'), ['year' => $year], ['class' => 'btn btn-default btn-sm'])); ?>

<?php echo e(Form::close()); ?>


<div class="panel panel-primary">
    <div class="panel-heading"><h3 class="panel-title"><?php echo e(__('report.sales_graph')); ?> <?php echo e($months[$month]); ?> <?php echo e($year); ?></h3></div>
    <div class="panel-body">
        <strong>Rp.</strong>
        <div id="monthly-chart" style="height: 250px;"></div>
        <div class="text-center"><strong><?php echo e(__('time.date')); ?></strong></div>
    </div>
</div>

<div class="panel panel-success table-responsive">
    <div class="panel-heading"><h3 class="panel-title"><?php echo e(__('report.detail')); ?></h3></div>
    <div class="panel-body">
        <table class="table table-condensed">
            <thead>
                <th class="text-center"><?php echo e(__('time.date')); ?></th>
                <th class="text-center"><?php echo e(__('transaction.transaction')); ?></th>
                <th class="text-right"><?php echo e(__('report.omzet')); ?></th>
                <th class="text-center"><?php echo e(__('app.action')); ?></th>
            </thead>
            <tbody>
                <?php $chartData = []; ?>
                <?php $__currentLoopData = month_date_array($year, $month); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dateNumber): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php
                    $any = isset($reports[$dateNumber]);
                    $count = $any ? $reports[$dateNumber]->count : 0;
                    $subtotal = $any ? $reports[$dateNumber]->amount : 0;
                ?>
                <?php if($any): ?>
                    <tr>
                        <td class="text-center"><?php echo e(date_id($date = $year.'-'.$month.'-'.$dateNumber)); ?></td>
                        <td class="text-center"><?php echo e($count); ?></td>
                        <td class="text-right"><?php echo e(format_rp($subtotal)); ?></td>
                        <td class="text-center">
                            <?php echo e(link_to_route(
                                'reports.sales.daily',
                                __('report.view_daily'),
                                ['date' => $date],
                                [
                                    'class' => 'btn btn-info btn-xs',
                                    'title' => __('report.daily', ['date' => date_id($date)]),
                                ]
                            )); ?>

                        </td>
                    </tr>
                <?php endif; ?>
                <?php
                    $chartData[] = ['date' => $dateNumber, 'value' => ($subtotal) ];
                ?>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
            <tfoot>
                <tr>
                    <th class="text-right"><?php echo e(__('app.total')); ?></th>
                    <th class="text-center"><?php echo e($reports->sum('count')); ?></th>
                    <th class="text-right"><?php echo e(format_rp($reports->sum('amount'))); ?></th>
                    <td>&nbsp;</td>
                </tr>
            </tfoot>
        </table>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('ext_css'); ?>
    <?php echo e(Html::style(url('css/plugins/morris.css'))); ?>

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

<?php $__env->startPush('ext_js'); ?>
    <?php echo e(Html::script(url('js/plugins/raphael.min.js'))); ?>

    <?php echo e(Html::script(url('js/plugins/morris.min.js'))); ?>

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

<?php $__env->startSection('script'); ?>
<script>
(function() {
    new Morris.Line({
        element: 'monthly-chart',
        data: <?php echo collect($chartData)->toJson(); ?>,
        xkey: 'date',
        ykeys: ['value'],
        labels: ["<?php echo e(__('report.omzet')); ?> Rp"],
        parseTime:false,
        xLabelAngle: 30,
        goals: [0],
        goalLineColors : ['red'],
        lineWidth: 2,
    });
})();
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\Users\Deni\Downloads\Compressed\Apotek candilkuya\grosir-obat-master\resources\views/reports/sales/monthly.blade.php ENDPATH**/ ?>