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


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


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



    <?php if(count($influencer) > 0): ?>
        <table class="table influencers">
            <thead>
            <tr>
                <th>Influencer</th>
                <th>Código</th>
                <th>Usuario</th>
                <th>Usuario fecha registro</th>
                <th>Usuario email</th>
                <th>Usuario número</th>
                <th>Usuario cuenta</th>
                <th>Número de recarga</th>
                <th>Sku</th>
                <th>Monto</th>
                <th>Descuento telecom</th>
                <th>Carrier</th>
                <th>Telecom request_id</th>
                <th>Telecom carrier_folio</th>
                <th>Payeezy transaction_id</th>
                <th>Descuento usuario</th>
                <th>Residual influencer</th>
                <th>Margen Cliqa</th>
                <th>Porcentaje residual</th>
            </tr>
            </thead>
            <tbody>
            <?php $__currentLoopData = $influencer; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <tr>
                    <td><?php echo e($item->influencer_name); ?></td>
                    <td><?php echo e($item->influencer_code); ?></td>
                    <td><?php echo e($item->user_name); ?></td>
                    <td><?php echo e($item->user_created); ?></td>
                    <td><?php echo e($item->user_email); ?></td>
                    <td><?php echo e($item->user_number); ?></td>
                    
                    <?php if($item->user_enabled == 1): ?>
                        <td>Habilitada</td>
                    <?php else: ?>
                        <td>Bloqueada</td>
                    <?php endif; ?>
                    
                    <td><?php echo e($item->beneficiary_number); ?></td>
                    <td><?php echo e($item->product_transaction_sku); ?></td>
                    <td>$<?php echo e($item->product_transaction_amount); ?></td>
                    <td><?php echo e($item->telecom_pct); ?>%</td>
                    <td><?php echo e($item->payment_transactions_carrier); ?></td>
                    <td><?php echo e($item->payment_transactions_request_id); ?></td>
                    <td><?php echo e($item->payment_transactions_carrier_folio); ?></td>
                    <td><?php echo e($item->payment_transactions_transaction_id); ?></td>
                    <td><?php echo e($item->discount_pct); ?>%</td>
                    <td>$<?php echo e((($item->influencer_residual * $item->product_transaction_amount)/100)); ?></td>
                    <?php if( (($item->telecom_pct - $item->discount_pct - $item->influencer_residual)/100) * ($item->product_transaction_amount) <= 0 ): ?>
                        <td style="color: red">$<?php echo e((($item->telecom_pct - $item->discount_pct - $item->influencer_residual)/100) * ($item->product_transaction_amount)); ?></td>
                    <?php else: ?>
                        <td>$<?php echo e((($item->telecom_pct - $item->discount_pct - $item->influencer_residual)/100) * ($item->product_transaction_amount)); ?></td>
                    <?php endif; ?>
                    

                    <td><?php echo e($item->influencer_residual); ?>%</td>
                </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                <tr>
                    <td><b>Total</b></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td>$<?php echo e($sum_telecom); ?></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td>$<?php echo e($sum_residual); ?></td>
                    
                    <?php if($sum_margen <= 0): ?>
                        <td style="color: red">$<?php echo e($sum_margen); ?></td>
                    <?php else: ?>
                        <td>$<?php echo e($sum_margen); ?></td>
                    <?php endif; ?>
                    
                    <td></td>
                </tr>

            </tbody>
        </table>



        <div class="chart">
            <canvas id="myChart"></canvas>
        </div>


       




    <?php else: ?>
        <h3>No hay resultados</h3>
    <?php endif; ?>




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


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

    <script>


    var grafica_meses = [],
        grafica_suma_residual = [];


    <?php $__currentLoopData = $grafica_meses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            grafica_meses.push("<?php echo e($item); ?>");
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>


    <?php $__currentLoopData = $grafica_suma_residual; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            grafica_suma_residual.push("<?php echo e($item); ?>");
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>





    var ctx = document.getElementById("myChart").getContext('2d');
    var myChart = new Chart(ctx, {
        type: 'bar',
        data: {
            labels: grafica_meses,
            datasets: [{
                label: 'Margen Cliqa',
                data: grafica_suma_residual,
                backgroundColor: [
                    'rgba(255, 99, 132, 0.2)',
                    'rgba(54, 162, 235, 0.2)',
                    'rgba(255, 206, 86, 0.2)',
                    'rgba(75, 192, 192, 0.2)',
                    'rgba(153, 102, 255, 0.2)',
                    'rgba(255, 159, 64, 0.2)'
                ],
                borderColor: [
                    'rgba(255,99,132,1)',
                    'rgba(54, 162, 235, 1)',
                    'rgba(255, 206, 86, 1)',
                    'rgba(75, 192, 192, 1)',
                    'rgba(153, 102, 255, 1)',
                    'rgba(255, 159, 64, 1)'
                ],
                borderWidth: 1
            }]
        }
    });
    </script>


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

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