<?php
/**
 * مالی — گزارش فروش (جدول اقلام فروش‌رفته).
 */
if (!defined('ABSPATH')) {
    exit;
}

$wc_ok = class_exists('WooCommerce') && function_exists('wc_get_orders');
?>
<?php
zerti_ui_component_open('financial-sales-report', [
    'class' => 'zerti-component-financial zerti-financial-sub-slot',
    'data-zerti-fin-active' => 'sales-report',
    'data-zerti-fin-component' => 'sales-report',
]);
?>
    <?php if (!$wc_ok) : ?>
        <?php zerti_ui_wc_required_notice(__('WooCommerce must be installed and active to view the sales report.', 'zerti')); ?>
    <?php else : ?>
        <div class="zerti-sales-report-panel">
            <div class="zerti-sales-report-wrap">
                <?php
                zerti_ui_toolbar_open(
                    __('Search and export sales report', 'zerti'),
                    'zerti-sales-report-grid-toolbar'
                );
                ?>
                    <div class="zerti-sales-report-grid-toolbar-search"></div>
                    <?php do_action('zerti_sales_report_toolbar_export'); ?>
                <?php zerti_ui_toolbar_close(); ?>
                <?php
                zerti_ui_ag_grid_region(
                    'zertiSalesReportGrid',
                    'zerti-sales-report-grid',
                    __('Sales report table', 'zerti')
                );
                ?>
            </div>
        </div>
    <?php endif; ?>
<?php zerti_ui_component_close(); ?>
