<?php if(empty($groups)): ?>
    <div class="alert alert-info">
        <i class="fa fa-info-circle"></i> <?php echo app('translator')->get('lang_v1.psp_no_data'); ?>
    </div>
<?php else: ?>
    <style>
        /* Thicker divider so each month block reads as its own section. */
        .psp-report-table .psp-month-start {
            border-left: 2px solid #8a8a8a !important;
        }
        .psp-report-table thead th {
            background-color: #f5f5f5;
        }
    </style>
    <?php $__currentLoopData = $groups; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $group): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <?php $__env->startComponent('components.widget', ['class' => 'box-primary']); ?>
            <div class="table-responsive">
                <table class="table table-bordered table-striped psp-report-table">
                    <thead>
                        <tr>
                            <th rowspan="2" class="text-center" style="vertical-align: middle;">
                                <?php echo e($group['name'], false); ?>

                            </th>
                            <th rowspan="2" class="text-center psp-month-start" style="vertical-align: middle;">
                                <?php echo app('translator')->get('lang_v1.psp_stock_balance'); ?>
                            </th>
                            <?php $__currentLoopData = $months; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ym => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <th colspan="2" class="text-center psp-month-start"><?php echo e($label, false); ?></th>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tr>
                        <tr>
                            <?php $__currentLoopData = $months; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ym => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <th class="text-center psp-month-start"><?php echo app('translator')->get('lang_v1.psp_purchase'); ?></th>
                                <th class="text-center"><?php echo app('translator')->get('lang_v1.psp_sales'); ?></th>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__currentLoopData = $group['products']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product_id => $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td>
                                    <?php echo e($product['name'], false); ?>

                                    <?php if($product['type'] === 'variable'): ?>
                                        <small class="text-muted">(<?php echo e(__('lang_v1.variable'), false); ?>)</small>
                                    <?php endif; ?>
                                </td>
                                <td class="text-right psp-month-start">
                                    <?php echo e(number_format($stock[$product_id] ?? 0, session('business.quantity_precision', 2), session('currency')['decimal_separator'], session('currency')['thousand_separator']), false); ?>

                                </td>
                                <?php $__currentLoopData = $months; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ym => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <?php
                                        $purchase_qty = $product['purchase'][$ym] ?? 0;
                                        $sales_qty = $product['sales'][$ym] ?? 0;
                                    ?>
                                    <td class="text-right psp-month-start"><?php echo e(number_format($purchase_qty, session('business.quantity_precision', 2), session('currency')['decimal_separator'], session('currency')['thousand_separator']), false); ?></td>
                                    <td class="text-right"><?php echo e(number_format($sales_qty, session('business.quantity_precision', 2), session('currency')['decimal_separator'], session('currency')['thousand_separator']), false); ?></td>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </div>
        <?php echo $__env->renderComponent(); ?>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php endif; ?>
<?php /**PATH /home/saprocom/cable.sapro365.com/cable/resources/views/report/partials/purchase_sale_product_data.blade.php ENDPATH**/ ?>