%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/silvzytp/crm-dub-code/storage/framework/views/
Upload File :
Create Path :
Current File : //home/silvzytp/crm-dub-code/storage/framework/views/45cf053e73d18a83702328187281b1b10abbbe6d.php

<?php $__env->startSection('title', $siteTitle); ?>
<?php $__env->startSection('action'); ?>
<button class="btn btn-sm btn-success printarea">Print</button>
<button type="button" class="btn btn-sm btn-primary export-btn">Export</button>
<?php $__env->stopSection(); ?>
<?php $__env->startPush('styles'); ?>
<style>
    .data-render{
        top: 10%;
        left: 50%;
        transform: translate(-10%, -50%);
    }
    .opacity-7{
        opacity: .4;
    }
</style>
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header">
                    <div class="row align-items-center">
                        <div class="col-4 col-md-8">
                            <h2 class="card-title mb-0">Monthly Report</h2>
                        </div>
                        <div class="col-8 col-md-4">
                            <form method="GET" id="filter-form">
                                <div class="d-flex align-items-center">
                                    <select name="year" class="form-control form-control-sm">
                                        <option value="">-- Select Year --</option>
                                        <?php
                                            $current_year = Carbon\Carbon::now()->format('Y');
                                        ?>
                                        <?php for($i=2000;$i<=$current_year; $i++): ?>
                                        <option value="<?php echo e($i); ?>" <?php echo e($i == $current_year ? 'selected' : ''); ?>><?php echo e($i); ?></option>
                                        <?php endfor; ?>
                                    </select>

                                    <select name="month" class="form-control form-control-sm mx-2">
                                        <option value="">-- Select Month --</option>
                                        <?php $__currentLoopData = MONTH; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($key); ?>"><?php echo e($value); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>

                                    <button type="button" class="btn btn-sm btn-primary filter-btn"><i class="fas fa-search"></i></button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <div class="card-body px-0 position-relative">
                    <div class="data-render position-absolute d-none">
                        <img src="<?php echo e(asset('uploads/images/table-loading.svg')); ?>" alt="">
                    </div>
                    <div class="table-responsive d-flex" id="filter-table">
                        <div id="print-table">
                            <style>
                                @media screen {
                                    .no_screen {display: none;}
                                    .no_print {display: block;}
                                    body {margin: 0;}
                                }

                                @media print {
                                    body,
                                    html {
                                        -webkit-print-color-adjust: exact !important;
                                        font-family: sans-serif;
                                        margin-bottom: 100px !important;
                                    }
                                    table{
                                        width: 100%;
                                    }
                                    .table-responsive{
                                        overflow-x: inherit !important;
                                    }
                                }
                                @page {
                                    size: landscape;
                                    margin: 5mm 5mm;
                                }
                            </style>
                            <table class="table">
                                <thead>
                                    <th style="min-width: 200px;">Agent</th>
                                    <?php $__currentLoopData = MONTH_DAY_DATA; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$day): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <th style="min-width: 80px;"><?php echo e($day); ?></th>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    <th style="min-width: 80px;">Total</th>
                                </thead>
                                <tbody>
                                    <?php
                                        foreach (MONTH_DAY_DATA as $key => $value) {
                                            $$key = 0;
                                        }
                                    ?>
                                    <?php $__currentLoopData = $agents; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $agent): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <?php
                                        $total = 0;
                                    ?>
                                    <tr>
                                        <td><?php echo e($agent->name); ?></td>
                                        <?php $__currentLoopData = MONTH_DAY_DATA; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$day): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php
                                                $call_count = DB::table('fresh_leads')
                                                    ->where('agent_id',$agent->id)
                                                    ->whereYear('created_at',Carbon\Carbon::now()->format('Y'))
                                                    ->whereMonth('created_at',$month)
                                                    ->whereDay('created_at',$key)->count();
                                                $$key += $call_count;
                                                $total += $call_count;
                                            ?>
                                        <td class="<?php echo e($call_count == 0 ? 'opacity-7' : ''); ?>"><?php echo e($call_count); ?></td>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        <td><strong><?php echo e($total); ?></strong></td>
                                    </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                                    
                                    <tr class="bg-success">
                                        <td style="min-width: 200px;"><strong>Total</strong></td>
                                        <?php
                                            $in_total = 0;
                                        ?>
                                        <?php $__currentLoopData = MONTH_DAY_DATA; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$day): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php
                                            $in_total += $$key;
                                        ?>
                                        <td><strong><?php echo e($$key); ?></strong></td>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        <td><strong><?php echo e($in_total); ?></strong></td>
                                    </tr>

                                    
                                    <?php
                                        foreach (MONTH_DAY_DATA as $day_id => $day_name) {
                                            $$day_id = 0;
                                        }
                                    ?>

                                    <?php $__currentLoopData = $sources; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $source): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <?php
                                        $source_column_total = 0;
                                    ?>
                                    <tr>
                                        <td><?php echo e($source->name); ?></td>
                                        <?php $__currentLoopData = MONTH_DAY_DATA; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $day_id=>$day_name): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php
                                                $source_count = DB::table('fresh_leads')
                                                    ->where(['marketing_source_id'=>$source->id])
                                                    ->whereYear('created_at',Carbon\Carbon::now()->format('Y'))
                                                    ->whereMonth('created_at',$month)
                                                    ->whereDay('created_at',$day_id)->count();
                                                $$day_id += $source_count;
                                                $source_column_total += $source_count;
                                            ?>
                                        <td class="<?php echo e($source_count == 0 ? 'opacity-7' : ''); ?>"><?php echo e($source_count); ?></td>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        <td><strong><?php echo e($source_column_total); ?></strong></td>
                                    </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                                    
                                    <tr class="bg-success">
                                        <td style="min-width: 200px;"><strong>Total</strong></td>
                                        <?php
                                            $source_in_total = 0;
                                        ?>
                                        <?php $__currentLoopData = MONTH_DAY_DATA; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $day_id=>$day_name): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php
                                            $source_in_total += $$day_id;
                                        ?>
                                        <td><strong><?php echo e($$day_id); ?></strong></td>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        <td><strong><?php echo e($source_in_total); ?></strong></td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

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

<?php $__env->startPush('scripts'); ?>
<script src="<?php echo e(asset('assets/js/printarea.js')); ?>"></script>
<script>
    $(document).on('click','button.filter-btn', function(){
        var year = $('select[name="year"]').val();
        var month = $('select[name="month"]').val();
        if (year == '' || month == '') {
            alert('The year and month field is requried!')
        }else{
            $.ajax({
                type: "GET",
                url: "<?php echo e(route('super.report.filter')); ?>",
                data: {year:year,month:month},
                cache: false,
                dataType: "JSON",
                beforeSend: function(){
                    $('.data-render').removeClass('d-none');
                },
                complete: function(){
                    $('.data-render').addClass('d-none');
                },
                success: function (response) {
                    $('#filter-table').html('');
                    $('#filter-table').html(response);
                }
            });
        }
    });

    $(document).on('click','button.export-btn',function(){
        $('#export-form')[0].reset();
        $('#export-modal').modal({
            keyboard: false,
            backdrop: 'static'
        });
    });

    $(document).on('submit','form#export-form',function(){
        $('#export-modal').modal('hide');
    });

    // print area
    $(document).on('click','button.printarea',function(){
        var mode   = 'iframe';        //popup
        var close  = mode = 'popup';
        var options = {
            mode    : mode,
            popClose: close
        }

        $('#filter-table').printArea(options);
    });
</script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('layouts.backend', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/silvzytp/crm-dub-code/resources/views/backend/report/index.blade.php ENDPATH**/ ?>

Zerion Mini Shell 1.0